| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This is a production-ready skeleton for building RESTful APIs in Node.JS using Express and MongoDB. The skeleton has many built-in features, such as authentication using JWT, request validation, unit and integration tests, continuous integration, API documentation, etc. For more details, please check the features list below.
git clone https://github.com/dejosli/NodeJS-RESTful-API-Boilerplate.git
cd NodeJS-RESTful-API-Boilerplate
rm -rf .gitnpm install -g yarn # if yarn is not installedyarn install
or
yarn install --frozen-lockfile # recommendedcp .env.example .env
# open .env and modify the environment variables (if needed)src
│ index.js
│
├───api
│ ├───controllers
│ │ └───tests
│ ├───docs
│ ├───lib
│ │ └───tests
│ ├───middleware
│ ├───models
│ │ └───plugins
│ ├───routes
│ │ └───v1
│ ├───services
│ │ └───tests
│ ├───utils
│ │ └───tests
│ ├───validators
│ │ └───tests
│ └───workers
├───config
├───core
└───testsyarn devyarn start{
"success": true,
"code": 200,
"message": "Success Response Message",
"data": {}
}{
"success": false,
"code": 400,
"message": "Error Response Message",
"errors": [
{
"field": "phoneNumber",
"message": "Phone number already exists for another user."
}
]
}Linting is done using ESLint and Prettier.
# lint code with ESLint
yarn lint
# try to fix ESLint errors
yarn lint:fix
# style code with Prettier
yarn prettier
# try to fix Prettier errors
yarn prettier:fixIn this project, ESLint is configured to follow the Airbnb JavaScript style guide with some modifications. It also extends eslint-config-prettier and eslint-plugin-security to turn off all rules that are unnecessary or might conflict with Prettier.
To modify the ESLint configuration, update the .eslintrc.json file. To modify the Prettier configuration, update the .prettierrc.json file.
To prevent a certain file or directory from being linted, add it to .eslintignore and .prettierignore.
To maintain a consistent coding style across different IDEs, the project contains .editorconfig
# run all tests
yarn test
# run all tests in watch mode
yarn test:watch
# run test coverage
yarn test:coverage
# run test coverage with coveralls
yarn test:coveralls# add all changes to staged
git add .
# run for conventional commits message
yarn commityarn prepareEvery project needs improvements, Feel free to report any bugs or improvements. Pull requests are always welcome.
Open-sourced software licensed under the MIT License
| Back | FazBrowse Home | New Git URL |