torredefarol24 / node-pg-ts

Using Typescript to create A Node/Express Application with Postgres DB Connection. Including DB Relations & Migrations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node With TypeScript & PostgreSQL

  • Backend - Express in TypeScript
  • Frontend - Not set yet, API Mode for now
  • Database - PostgreSQL + TypeORM (ORM)

Check it out

  • Setup AppKeys - for DB Connection
$ cd node-pg-ts
$ touch src/keys/appKeys.ts
  • Update appKeys.ts
const appKeys:any = {
  API_PORT : <WHATEVER_YOU_WANT>,
  DB_TYPE: "postgres",
  DB_HOST: <YOUR_PGDB_HOST>,
  DB_PORT: 5432,
  DB_USERNAME: <YOUR_PGDB_USER>,
  DB_PASSWORD: <YOUR_PGDB_PASS>,
  DB_NAME: <YOUR_PGDB_NAME>,
}

export default appKeys;
  • Setup .env
$ cd pgTsEample
$ touch .env
  • Update .env - for running Migrations
DATABASE_DRIVER=postgres
DATABASE_USER=<YOUR_PGDB_USER>
DATABASE_HOST=<YOUR_PGDB_HOST>
DATABASE_PASS=<YOUR_PGDB_PASS>
DATABASE_PORT=5432
DATABASE_NAME=<YOUR_PGDB_NAME>
  • Install Package Dependencies
$ cd node-pg-ts
$ yarn install

# Or, with npm
$ npm install
  • Run App in DEV Mode
$ cd node-pg-ts
$ yarn run watch-ts
$ yarn run watch-node
  • Run App in PRODUCTION Mode
$ cd node-pg-ts
$ yarn run build-ts
$ yarn run start-app

About

Using Typescript to create A Node/Express Application with Postgres DB Connection. Including DB Relations & Migrations.


Languages

Language:TypeScript 98.4%Language:JavaScript 1.6%