Skip to content

NodeJs-Express starter kit with preconfigured Postgres database. It uses ES6+ transpiled to ES5 by babel.

License

Notifications You must be signed in to change notification settings

BaharaJr/nodejs-starter

Repository files navigation

Welcome to node-starter 👋

License: WTFPL

Minimal Express / Nodejs Starter with PostgreSQL Database(No ORM)

Requirements


Getting started

Setting up for development

$ git clone [email protected]:BaharaJr/nodejs-starter.git
  • change directory to nodejs-starter:
$ cd nodejs-starter
  • Create .env file and add db URL. Sample: DATABASE_URL=postgres://username(DEFAULT is postgres):your-db-passowrd@your-hostname(i.e localhost):postgres-port(DEFAULT is 5432)/your-db-name
$ cp .env.example .env
  • In the .env file, also add the port you would like to use. i.e PORT=4000
  • Install packages with
$  npm i

Run

$ npm run start

Runs the application with nodemon. Server is listening on Port 4000 by default. This can be overwritten by PORT constant in .env file.

The App will run on the port you added in your .env file (localhost:YOUR-PORT)

Test Endpoint: /test

Request

GET test
Host: localhost:4000

Response

{
  "title": "NodeJs Club is awesome"
}

Test Database Connection: /connection

GET test
Host: localhost:4000

Response

{
  "databasename": "databse_name",
  "command": "SELECT",
  "catalogname": "current_catalog",
  "format": "text",
  "message": "Database was connected successfully"
}

Run tests

npm test

Show your support

Give a ⭐️ if this project helped you!

📝 License

This project is WTFPL licensed.

About

NodeJs-Express starter kit with preconfigured Postgres database. It uses ES6+ transpiled to ES5 by babel.

Topics

Resources

License

Stars

Watchers

Forks