Skip to content

Starter for node.js REST API using Express, Sequelize, Mocha

Notifications You must be signed in to change notification settings

DenisRupp/API-express-starter

Repository files navigation

Express REST API Starter with postgres

Build Status Coverage Status code style: prettier Greenkeeper badge

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

Features

Requirements

Getting Started

Clone the repo and make it yours:

git clone --depth 1 https://github.com/DenisRupp/express-starter
cd express-starter
rm -rf .git

Install dependencies:

yarn

Set environment variables:

cp .env.example .env

Set database configuration:

cp src/database/config.example.js src/database/config.js

Crete database

sequelize db:create --env development

Running Locally

yarn local

Running in Production

yarn start

Database commands

# run all migrations
yarn migrate

# run all seeds
yarn seeds

# generate new migration
sequelize migration:generate --name new-migration

# generate new seed
sequelize seed:generate --name new-seeds

More commands here.

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

Logs

# show logs in production
pm2 logs

Deploy

# deploy to dev
pm2 deploy dev

Documentation

# generate and open api documentation
yarn docs

Inspired by danielfsousa

Releases

No releases published

Packages

No packages published

Languages