- Node.js 8
- express
- sequelize
- joi request validation
- i18n
- error handling
- Jest testing framework
- eslint
- commitlint
- Travis CI, Gitlab CI ready
You may not be comfortable for the commit hook. You can remove eslint, commitlint checking by yarn remove husky. For more information about commit hook, please take a look at husky
You may want to use other orm library like mongoose. To remove sequelize, you may do the following:
- remove all model files under
/src/models - update the bootstrap method in
src/server.jsto remove sequelize setups - remove
src/utils/dbConnection.js,src/utils/loadModels.js - update
.env - update
test/setup.jsto remove sequelize setups
git clone git@gitlab.com:wsws/express-api-starter.git
yarn
# start the development server
yarn run dev
# run unit test
yarn test
# watch and run unit test
yarn run dev-test
# run eslint
yarn run lint- nvm
- yarn
- visual studio code (VSCode has JS IntelliSense)
- with the following plugins
- Code Spell Checker
- EditorConfig for VS Code
- ESLint
- Git Lens
- Paste and Indent
- Auto-Open Markdown Preview
- or WebStorm
- or other coding tool with similar features of 3.2 - 3.4
- Git commits
- This project uses [commitlint] (https://github.com/marionebl/commitlint)
- [commits must follow this format] (#commit-formats)
type(scope?): subject body? footer?- a commit must focus on one topic only
- a commit should not involve too much files (>5 files)
- a commit subject should start with a present tense verb (except a fix commit)
- Placing files
- never use index.js
- [favor module hierarchy instead of file type] (#favor-module-hierarchy-instead-of-file-type)
The format of a commit must be
type(scope?): subject
body?
footer?
Where type can only be
[
'feat', // adding, completing a new feature
'fix', // bug fix
'docs', // changes to documentation
'refactor', // refactoring production code, formatting, missing semi colons,
'test', // adding missing tests, refactoring tests; no production code change
'config', // updating grunt tasks etc; no production code change
]Do: put files with different file types but with related business logic into one folder
- placing user.controller.js, user.model.js, user.service.js into one folder
Do not: put all files with the same type into one folder
- placing all .js into one folder
- placing all .css into one folder
- placing all .service.js into one folder
- placing all .model.js into one folder
- placing all .controller.js into one folder