Skip to content

Repository files navigation

Express ES2017 REST API Boilerplate

PRs Welcomenpm versionBuild StatusCoverage StatusGreenkeeper badge

Boilerplate/Generator/Starter Project for building RESTful APIs and microservices using Node.js, Express and MongoDB

Features

Requirements

Getting Started

Clone the repo and make it yours:

git clone --depth 1 https://github.com/danielfsousa/express-rest-es2017-boilerplate
cd express-rest-es2017-boilerplate
rm -rf .git

Install dependencies:

yarn

Set environment variables:

cp .env.example .env

Running Locally

yarn dev

Running in Production

yarn start

Lint

# lint code with ESLint
yarn lint
# try to fix ESLint errors
yarn lint:fix
# lint and watch for changes
yarn lint:watch

Test

# run all tests with Mocha
yarn test# run unit tests
yarn test:unit
# run integration tests
yarn test:integration
# run all tests and watch for changes
yarn test:watch
# open nyc test coverage reports
yarn coverage

Validate

# run lint and tests
yarn validate

Logs

# show logs in production
pm2 logs

Documentation

# generate and open api documentation
yarn docs

Docker

# build docker image
docker build -t <username>/ssh-bot .# run container
docker run -p 3000:3000 -e NODE_ENV='development' \
-e PORT='3000' \
-e DISCORD_TOKEN='xxx' \
-e PREFIX='!' \
-e OWNER='000' \
<username>/ssh-bot
# OR
kubectl run --port=3000 --env="NODE_ENV=development" --env="PORT=3000" --env="DISCORD_TOKEN=xxx" --env="PREFIX=!" --env="OWNER=000" --image=trichandra/ssh-bot ssh-bot
# run container locally
yarn docker:dev
or
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
# run container in production
yarn docker:prod
or
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
# run tests
yarn docker:test
or
docker-compose -f docker-compose.yml -f docker-compose.test.yml up

Deploy

Set your server ip:

DEPLOY_SERVER=127.0.0.1

Replace my Docker username with yours:

nano deploy.sh

Run deploy script:

yarn deploy
or
sh ./deploy.sh

Tutorials

Inspirations

License

MIT License - Daniel Sousa

About

Super Spell Heroes Bot

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages