The code is present in the master branch. Hi this is Parth Ulhas Vaidya and this is my readme file for the given assignment. Install SQlite 3 db to view the userdata.db table in UI form if required The main folder consist of node_modules, app.js, database.js, package-lock.json and userdata.db
Here are the steps to run the assignment.
-
Open terminal and write npm init -y [This initializes the node modules]
-
Next step is to initialize npm install express sqlite3 body-parser bcrypt multer
-
Next step is to initialze npm install knex sqlite3
-
Once done run-> node ./database.js [to check the database data]
-
Then run -> node ./app.js which should show the message as Server is running.
Since it a backend project it is hosted on vercel app: https://enhanced-authentication-api.vercel.app/
After the initialization here are the steps to test the data using Postman
-
To register use the endpoint as http://localhost:3000/register
-
Then insert the data in raw format for example { "name": "Abcde fgh", "phoneNumber": "123456799", "email" : "abc@gmail.com", "password" : "password1564" }
-
To use the login endpoint use http://localhost:3000/login
-
Then insert the data in raw format { "phoneNumber": "123456799", "password" : "password1456"
-
use the profile endpoint use http://localhost:3000/profile with the JWT token as authenticator(One is PUT and other is GET as per assignment requirements)
-
logout endpoint http://localhost:3000/logout
-
http://localhost:3000/users with jwt you can get the users which are admin and public/private .
NOTE: This may not be the perfect representation and can have some errors but i assure the logic used is correct and it is a request it can be taken into consideration