DEV Community

User Authorization in NodeJS using PostgreSQL

Shreshth Goyal on August 30, 2021

User authentication is one of the integral parts while developing a web application. Although we can use third party apps like Firebase or Passport...
Collapse
 
cide74 profile image
Régis BRUNET BLEC • Edited

hello great TUTO, but in your 'Users' table schema in PostgresSQL, there is an error there is no "," to

 '' password " varchar NOT NULL    ', '
); 
Enter fullscreen mode Exit fullscreen mode

otherwise the table does not work.

Here is my DataBase on ElephantSQL

BEGIN;

-- Data Table --
DROP TABLE IF EXISTS "users" CASCADE;

CREATE TABLE IF NOT EXISTS "users" (
     - serial PRIMARY KEY for unique id
     "id" SERIAL PRIMARY KEY,
     "name" text NOT NULL,
     "email" text NOT NULL UNIQUE,
     "phonenumber" text NOT NULL UNIQUE,
     "password" varchar NOT NULL
);

-- DataBase --
INSERT INTO "users" (
     "id",
     "name",
     "E-mail",
     "phonenumber",
     "password"
) VALUES

     (1, 'john', 'john.doe@email.zzz', 'phoneNumber', 'password');

COMMIT;
Enter fullscreen mode Exit fullscreen mode
Collapse
 
shreshthgoyal profile image
Shreshth Goyal • Edited

Hi! Thanks for the compliment, but this schema did work for me while creating my database diagram for this user authentication.
Also I'll look into it, thanks for the insights.

Collapse
 
srishtipandey10 profile image
Srishti-Pandey10

Very Helpful Content !!🤩

Collapse
 
satyamshukla007901 profile image
Satyamshukla007901

Great work bro🤟🤟

Collapse
 
shreshthgoyal profile image
Shreshth Goyal

Thanks satyam 😀

Collapse
 
addy0110 profile image
Adarsh Pandey

God or wot 👏👏

Collapse
 
shreshthgoyal profile image
Shreshth Goyal

Thanks adarsh 😄💫

Collapse
 
ifierygod profile image
Goran Kortjie

Spectacular work!

Collapse
 
shikhar13012001 profile image
Shikhar

Woah man ! Awesome so clean and helpful!
This will surely help in my project !!

Collapse
 
shreshthgoyal profile image
Shreshth Goyal

Thanks for these words Shikhar, Feeling glad that it was helpful for you. 😄

Collapse
 
ambujraj2001 profile image
Ambuj Raj

👍👍

Collapse
 
shreshthgoyal profile image
Shreshth Goyal

😄

Collapse
 
rjtsharma3538 profile image
Rajat Sharma

Amazing bro🍻

Collapse
 
shreshthgoyal profile image
Shreshth Goyal

😄