Skip to content

Latest commit

 

History

History
106 lines (72 loc) · 1.83 KB

README.md

File metadata and controls

106 lines (72 loc) · 1.83 KB

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.