generator-loopback-postgresql

1.0.1 • Public • Published

Loopback-PostgreSQL generator

Description

Loopback-PostgreSQL generator is a yeoman package that allows you to scaffold a new REST API loopback project that are using:

  • LoopBack - Node.js REST API framework
  • PostgreSQL - PostgreSQL loopback connector
  • Winston - Logging module that configured to write in DB, logfile and console
  • .env module - Library for .env credentials management
  • DB migrations - Database migration framework for Node.js, settings and commands are described below

Also current boilerplate uses S3 component and SMTP.

Install

  1. Install: npm install -g generator-loopback-postgresql
  2. Install yeoman: npm install -g yo if it isn't exist yet
  3. Run: yo loopback-postgresql

Usage

After project generation you should edit your .env file and setup all correct credentials for your services.

.env

BUCKET=default.bucket.name
BUCKET_KEY=bucket.key
BUCKET_KEY_ID=bucket.id

RDS_HOSTNAME=localhost
RDS_PORT=5432
RDS_DBNAME=dbname
RDS_USERNAME=postgres
RDS_PASSWORD=postgres

SMTP_HOST=smtp.host.name
SMTP_USERNAME=smtp.user.name
SMTP_PASSWORD=smtp.password

DEBUG=*

Loopback Debug values

Migrations

You have an ability to work with migrations. Before start you must edit settings for this module. ./migrations/database.json A new application has a few scripts for db migrations:

npm run migrate up

The up command executes the migrations of your currently configured migrations directory.

npm run migrate down

The down command executes the migrations of your currently configured migrations directory.

npm run migrate reset

The reset command is a shortcut to execute all down migrations and literally reset all migrations which where currently done.

npm run migrate create

The create command creates templates for you, there are several options for this.

Directory of migrations by default is located at: ./migrations/

Further information about db migrations you can find on this page.

Package Sidebar

Install

npm i generator-loopback-postgresql

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • stanislavt