/express-bookshelf-api-starter

A starter pack using ExpressJS Framework with Bookshelf ORM for API development

Primary LanguageJavaScriptMIT LicenseMIT

Requirements

  • NodeJS 8.11.0
  • PostgreSQL 10.0.0

Setup

Clone the repository and install the dependency:

$ git clone https://github.com/ralphcasipe1/express-bookshelf-api-starter.git <optional: other_name>
$ cd <application_name>
$ rm -rf .git # if it's terminal
$ remote-item .git # powershell
$ rd /s /q # windows command prompt

Copy .env.example as .env and update the application details and database credentials.

Run the migrations and seeds.

$ npm run migrate
$ npm run seed

Start the application in development.

$ npm run start:dev

Creating New Migrations

Example:

$ npm run make:migration create_users_table

Creating New Seeds

Example:

$ npm run make:seed insert_users

Using other SQL driver other than PostgreSQL

Install the driver first:

$ npm i sqlite3 # for sqlite
$ npm i mysql # for mysql
$ npm i mysql2 # for mysql 2
$ npm i oracle # for oracle
$ npm i mssql # for mssql

Update your .env.

- DB_CLIENT=pg
+ DB_CLIENT=<name of the driver you installed>

Example:

DB_CLIENT=mysql

Please remove the pg driver if you don't need it.

License

This repository is under MIT License