Solution for QontenttAi assignment
Project is hosted on vercel service on -> https://qontenttai-assignment.vercel.app/graphql
to test open the apollo sandbox wth below link -> https://studio.apollographql.com/sandbox/explorer
paste the hosted url(vercel link) and test, schema should be already loaded
(make sure node is already installed)
npm i
Add DATABASE_URL db(postgres/mysql) url and JWT_SECRET in the .env and run following commands
1. prisma migrate dev -n migration01
2. prisma generate client
node app.js
Visit http://localhost:3000/graphql and apollo sandbox will open for testing
- User Registration: When a user registers, their password is hashed with a salt and stored securely in the database.
- User Login: When a user logs in, their password is authenticated, and a JWT token is generated and sent as a response.
- Protected Routes: The client includes this token in the headers of requests to protected routes (like viewing the profile). The server verifies the token to grant access.