- User Registration
- Basic Authentication with username and password
- Admin use react-admin
- Oauth 2.0 Authentication
- Upload Photo to S3 amazon
- Docker
Fist, install Yeoman and generator-expressjs-rest using npm (we assume you have pre-installed node.js).
npm install -g yo
npm install -g generator-expressjs-rest
Then, you can use yo
to generate your project.
yo expressjs-rest # generate a new project
yo expressjs-rest:api # generate a new api endpoint inside your project
After you generate your project, these commands.
cd your-project-name
mv .env.example .env
docker-compose build
docker-compose run --rm client yarn build
docker-compose up
src/
├─ api/
│ ├─ auth/
│ │ ├─ index.js
│ │ ├─ auth.service.js
│ │ ├─ auth.validation.js
│ │ ├─ auth.controller.js
│ │ └─ auth.test.js
│ ├─ uploads/
│ │ ├─ index.js
│ │ ├─ upload.controller.js
│ ├─ users/
│ │ ├─ index.js
│ │ ├─ user.controller.js
│ │ ├─ user.validation.js
│ │ ├─ user.model.js
│ │ ├─ user.service.js
│ │ └─ user.test.js
│ └─ index.js
├─ services/
│ ├─ index.js
│ ├─ jwt.js
│ ├─ logger.js
│ ├─ mailgun.js
│ ├─ mongoose.js
│ ├─ passport.js
│ ├─ response.js
│ ├─ s3.js
│ ├─ swagger.js
│ └─ your-service.js
├─ app.js
├─ config.js
└─ index.js
Here is where the API endpoints are defined. Each API has its own folder.
It defines the Mongoose schema and model for the API endpoint. Any changes to the data model should be done here.
This is the API controller file. It defines the main router middlewares which use the API model.
This is the entry file of the API. It defines the routes using, along other middlewares (like session, validation etc.), the middlewares defined in the some-endpoint.controller.js
file.
Here you can put helpers
, libraries
and other types of modules which you want to use in your APIs.
- Support optional phone authentication
- Support optional email confirmation process
- Support Twitter and other social login methods
- Socket.io support
PRs are welcome.
@minhuyen and all contributors
MIT © minhuyen