you must click the button use this template
- using template - create name of your repository
- rename link readme - change link repo default
github/firmanJS/express-template
to your repo - codeclimate - you must integrate repo to codeclimate don't forget set your repo is public for integrated and in github repo settings create secret key with name
CC_TEST_REPORTER_ID
and value from code climateREPORTER ID
in https://codeclimate.com/
or clone this repository via https :
https://github.com/firmanJS/express-template.git
default branch using commonjs
if you want version ecmascript you must checkout to branch version/ecmascript
- Node.js - http://nodejs.org/
- Express - http://expressjs.com/
- nodemon - https://www.npmjs.com/package/nodemon
- pm2 - https://www.npmjs.com/package/pm2
- error handling
- database structure folder
- testing with jest
- coverage use jest
- with docker example
- validiation, use express-valdator and joi
- pagination example
- custom message api response
- eslint airbnb base
- jestjs - https://jestjs.io/
cp .env-sample .env
- via yarn or npm :
# install package
npm install or yarn install
# running app
npm run dev or yarn dev
# running unit tetsing
npm run test or yarn test
- via make :
# start aplication with docker
make docker-start
# stop docker container
make docker-stop
# remove docker container
make docker-down
PORT=2000
TZ=Asia/Jakarta
MONGO_SERVICE=# uri mongodb
AUTH_SOURCE= #auth service
SECRET_KEY= #jwt secret key here
docker-compose up --build
docker-compose up --build -d
# install package
docker-compose exec boillerplate npm install
# running unit testing
docker-compose exec boillerplate npm run test
using swagger check in folder static
.
├── .github/ * all workflows github actions
├── caprover/ * for deployment in caprover
├── coverage/ * all output coverage
├── docker/ * all dockerfile
├── src/ * all source code in here
└── config/ * all configuration file here
| └── db.js * configuration database
└── database/ * all models schema file here
| └── models * all models file
| └── migrations * all migrations file
| └── seeders * all seeders file
└── handlers/ * all file handlers here
| └── index.js * register all handler here
└── lang/ * setup language
| └── index.js * register all language here
└── middleware/ * all middleware file here, for check before next to api
└── repository/ * all file repository for single db or multiple db
| └── monggo * register all monggo
| └── mysql * register all mysql
| └── postgresql * register all postgresql
└── routes/ * all file route here
| └── index.js * register all route
└── static/ * config for swagger
| └── swagger.json * config swagger
└── test/ * all test file here
| └── index.js * test apps
└── utils/ * all utils file here
- Guideline:
- Use camelCase for variable name, naming function, load module or other functions
- Use UpperCase for Constant Variable
- Use PascalCase for class name, models
- Use snake_case for file name as variable
- Function name use Verb
- Variable name use Noun