A boilerplate for building RESTful APIs using Node.js, PostgreSQL, koa, knex, bookshelf.
- Install Node.JS LTS version
- Install PostgreSQL
- Clone this repository and enter on the respective folder
- Install dependencies running:
yarn
ornpm install
- Create database (by follow the commands):
- CREATE USER
user
WITH PASSWORDpassword
- CREATE DATABASE
database
- GRANT ALL PRIVILEGES ON DATABASE
database
touser
- Install
citext
extension on your database with the commandCREATE EXTENSION citext;
- Change name value of .env.example to .env and set the key SECRET to any value you wish
- Change DATABASE_URL to postgress://
user
:password
@localhost
/database
- Run migrations:
yarn db:migrate
- Run seeds:
yarn db:seed
- Run
yarn start
oryarn dev
to start server
- Run tests:
yarn test
├── /src
| ├── /controllers
| ├── /database
| | ├── /migrations
| | ├── /seeds
| ├── /helpers
| ├── /middleware
| ├── /models
| ├── /routes
| ├── /validators
├── /test