Skip to content

A boilerplate for building RESTful APIs using Node.js, PostgreSQL, koa, knex, bookshelf.

Notifications You must be signed in to change notification settings

silaasdantas/nodejs-back-boilerplate

Repository files navigation

Node API boilerplate by nave.rs

A boilerplate for building RESTful APIs using Node.js, PostgreSQL, koa, knex, bookshelf.

Getting started

Installation

  1. Install Node.JS LTS version
  2. Install PostgreSQL
  3. Clone this repository and enter on the respective folder
  4. Install dependencies running: yarn or npm install

Things to do before run the project:

  1. Create database (by follow the commands):
  • CREATE USER user WITH PASSWORD password
  • CREATE DATABASE database
  • GRANT ALL PRIVILEGES ON DATABASE database to user
  1. Install citext extension on your database with the command CREATE EXTENSION citext;
  2. Change name value of .env.example to .env and set the key SECRET to any value you wish
  3. Change DATABASE_URL to postgress://user:password@localhost/database
  4. Run migrations: yarn db:migrate
  5. Run seeds: yarn db:seed
  6. Run yarn start or yarn dev to start server

Testing

  1. Run tests: yarn test

Directory Structure

├── /src
|   ├── /controllers
|   ├── /database
|   |    ├── /migrations
|   |    ├── /seeds
|   ├── /helpers
|   ├── /middleware
|   ├── /models
|   ├── /routes
|   ├── /validators
├── /test

Insomnia

Run in Insomnia

Styleguide

Standard - JavaScript Style Guide

About

A boilerplate for building RESTful APIs using Node.js, PostgreSQL, koa, knex, bookshelf.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.1%
  • Shell 1.3%
  • Dockerfile 0.6%