Skip to content

This Node Application is a simple CRUD application connecting to postgreSQL Database backend.

Notifications You must be signed in to change notification settings

Karan-S-Mittal/restfulAPI-node-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTful API - Node - PostgreSQL

This application is REST API performing CRUD operations using postgreSQL Database.
The application integrates nodejs and postgresql.

Installation

node index.js

You should have nodejs and postgreSQL installed to run this application.

Execute these commands one by one to in psql shell.

  1. Make a new User named me. givig him permission to create database.

    CREATE ROLE me WITH LOGIN PASSWORD 'password';
    ALTER ROLE me CREATEDB;
  2. Login with the user me by restarting the shell/session.

  3. Create a new Database named API while logged in as user me.

    CREATE DATABASE api;
  4. Use that database.

    \c api
    
  5. Create a new Table

    CREATE TABLE users (
    ID SERIAL PRIMARY KEY,
    name VARCHAR(30),
    email VARCHAR(30)
    )
  6. Add some random values (optional)

    INSERT INTO users (name, email)
    VALUES ('Karan', '[email protected]'), ('Shyam', '[email protected]'), ('Ali', '[email protected]');
    

pro tip: if you found errors in the code above, check your commas. postgreSQL takes ' and not ".

Author

Karan Mittal

About

This Node Application is a simple CRUD application connecting to postgreSQL Database backend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published