A boilerplate for building RESTful APIs using Node.js, PostgreSQL, koa, knex, bookshelf.
- Install Node.JS latest version
- Install PostgreSQL
- Clone this repository
- Install dependencies, just run in project folder:
yarn
ornpm install
- Create database (by follow the commands):
- CREATE USER
user
WITH PASSWORDpassword
- CREATE DATABASE
database
- GRANT ALL PRIVILEGES ON DATABASE
database
touser
- 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