Skip to content

darsantiago/passport-postgres-authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

passport-postgres-authentication

A little concept program with authentication using NodeJS with Passport, PostgreSQL, and ExpressJS. It contains login, registration, and password updating functionality.

Why?

I've built small applications with authentication using Passport with MongoDB, but not with Postgres. This gave me the opportunity to learn something new. Hopefully it can help someone else with their projects.

Getting Started

  1. Clone the repository

git clone https://github.com/ad3m3r5/passport-postgres-authentication.git

  1. Install necessary packages

npm install

  1. Create your database and table in PostgreSQL. This is the statement I used.

CREATE TABLE users (
    id UUID NOT NULL,
    username TEXT NOT NULL UNIQUE,
    password TEXT NOT NULL,
    CONSTRAINT users_pkey PRIMARY KEY(id)
)
WITH (oids = false);

  1. Create the file .env, which will store database connection information. Add the following variables using your respective values.

PGHOST=<postgres_host>
PGPORT=<postgres_port>
PGDATABASE=<database_name>
PGUSER=<postgres_username>
PGPASSWORD=<postgres_password>

  1. Run the application

node server.js

Tech/Software Used

Main Packages Used

Screenshots

User login Login Page User registration Registration Page Update/change account password Account Page