Giter VIP home page Giter VIP logo

js-sport's Introduction

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

How To use

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 climate REPORTER 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

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

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

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

.
├── .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

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
    • Use snake_case for file name as variable
    • Function name use Verb
    • Variable name use Noun

js-sport's People

Contributors

marcopo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.