ES6 Express server skeleton which includes PostgreSQL through Sequelize, testing environment with Mocha, env variables with Dotenv
- Configurations will be stored in
./server/config/*.js
files which retrieves information from system environment:process.env
- Clone the project:
git clone https://github.com/niemisami/express-server-base.git
- Open project folder and run:
npm install
- Create
.env
file on project root and copy and fill the necessary environment variables (If there is any question contact the author Sami Nieminen):
NODE_ENV=development
PORT=3000
DB_URL=<psql_url>
DB_USER=<psql_user_name>
DB_PASSWORD=<psql_user_password>
AUTH_SECRET=<secret message for JWT>
- Run:
npm start
ornpm dev
which starts server withnodemon
git and without linter
- Get latest changes:
git pull
- Check installations:
npm install
- Build:
npm run serve
Tests are located in ./test/
folder with prefix .spec.js
.
Run: npm run test
Using
npm run dev
starts server withnodemon
but will ignore changes inside test files.
Database calls are dealt by Sequelize based on the models defined in ./server/models/*
Folders node_modules
and .vscode
are hidden on editor. Configurations in .vscode/settings.json
13.11.2017
Initial setup