Skip to content

firmanJS/auth-service

Repository files navigation

Express Template Boillerplate RestfullApi

Maintainability Test Coverage Node.js CI made-with-nodejs made-with-expressjs Ask Me Anything ! GitHub license GitHub release Github all releases GitHub issues GitHub pull-requests PRs Welcome

Core Stack

Feature

  1. error handling
  2. database structure folder
  3. testing with jest
  4. coverage use jest
  5. with docker example
  6. validiation, use express-valdator and joi
  7. pagination example
  8. custom message api response
  9. eslint airbnb base

Unit testing

How To run

copy environment variable

cp .env-sample .env

run manualy

  • 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 

fill in the copied environment earlier

APP_PORT=2000
TZ=Asia/Jakarta
MONGO_SERVICE=# uri mongodb
AUTH_SOURCE= #auth service
SECRET_KEY= #jwt secret key here

#Mongodb config
MONGO_PORT=27017
MONGO_INITDB_ROOT_USERNAME= #username
MONGO_INITDB_ROOT_PASSWORD= #password
MONGO_INITDB_DATABASE= #db name

run with docker-compose

docker-compose up --build

or run with background process

docker-compose up --build -d

execution npm with container docker

# install package
docker-compose exec boillerplate npm install

# running unit testing
docker-compose exec boillerplate npm run test

Documentation API

using swagger check in folder static

Project Structure

.
├── api/              * all api file 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
├── helpers/          * all helper or middleware file here
├── middleware/       * all middleware file here, for check before next to api
├── routes/           * all file route here
|   └── index.js      * register all route
├── static/           * all configuration swagger
|   └── path          * custom your path api
|   └── schema        * custom schema body
├── test/             * all test file here
|   └── index.js      * test apps
├── utils/            * all utils file here

Code Style Guides

  • Guideline:
    • Use camelCase for variable name, naming function, load module or other functions
    • Use UpperCase for Constant Variable
    • Use PascalCase for class name, models, api, route, load module model
    • Use snake_case for file name as variable
    • Function name use Verb
    • Variable name use Noun

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Generated from firmanJS/express-template