Code42Cate / restexpress

https://restexpress.dev

Home Page:https://restexpress.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contributors Forks Stargazers Issues MIT License


Logo

RESTexpress

RESTexpress is a highly customizable REST backend and API generator.
Explore the docs »

· Report Bug · Request Feature

Table of Contents

About The Project

RESTexpress is a highly customizable REST backend and API generator.

Here's why this is some cool shit:

  • Your time should be focused on creating amazing features, not thinking about authentication, user management and project structure.
  • You shouldn't have to implement simple CRUD operations over and over again.

Of course, no template will serve all projects since your needs may be different. So we made it easy to add your own mongoose plugins, services and middleware.

Built With

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

The easiest way to install mongoDB is with docker. A simple docker-compose file would look like this:

version: "3.8"
services:
    mongo:
        image: mongo:4.2.5
        ports:
            - "27017:27017"

Installation

  1. Clone the repo
git clone git@github.com:tguelcan/restexpress.git
  1. Install dependencies
yarn
  1. Enter your variables in .env.example and rename the file to .env

Usage

Start the server with:

yarn run dev

If it succesfully started, the output should look like this: yarn run dev screenshot

You should now be able to see the Documentation

You can run tests with:

yarn run test

or

yarn run test:coverage

to check the code coverage

Adding routes / plugins / services

Mongoose plugins

  1. Read about Mongoose Plugins
  2. Create your new plugin in src/services/mongoose/plugins
  3. Make sure to export it in src/services/mongoose/index.js
  4. Access the plugin in your model like this:
import { yourPlugin } from 's/mongoose'

Adding routes

yarn run generate

Enter your resource name

=> All required files should now be generated and you can start writing code!

  1. Define ACL in /api/resource-name/acl.js
  2. Define model in /api/resource-name/model.js
  3. Write tests in /tests/api/resoure-name.test.js
  4. Add middleware in /api/resource-name/index.js
  5. Implement controllers in /api/resource-name/controller.js

Services

  1. Create your new service in a separate folder in src/services
  2. Import it when necessary with s/yourservice

Deployment

Heroku + MongoDB Atlas = 👁👄👁

  1. Create a new heroku app
  2. Enter the needed environment variables:
MASTER_KEY=
JWT_SECRET=
MONGODB_URI=
SENDGRID_KEY=

You can get a free mongoDB database from MongoDB Atlas and a free SendGrid account for testing

  1. heroku git:remote -a <your-app-name>
  2. git push heroku master
  3. Your API should now be online and accessible under: https://<your-app-name>.herokuapp.com/ 🥳

Docker

// TODO:

Roadmap

See the open issues for a list of proposed features (and known issues)

Or take a look at the currently empty project board

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Jonas Scholz - @jscholz42

Tayfun Gülcan - @Tayfuuu

Acknowledgements

recommended sources

About

https://restexpress.dev

https://restexpress.dev

License:MIT License


Languages

Language:JavaScript 80.9%Language:Handlebars 15.9%Language:HTML 3.1%Language:Shell 0.1%