An Interest In:
Web News this Week
- April 28, 2024
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
April 11, 2023 01:38 pm GMT
Original Link: https://dev.to/vulcanwm/login-and-signup-with-nextjs-am7
Login and Signup with Next.js
I recently started learning Next.js and I wanted to improve my Next.js skills, so I decided to make a simple Login and Signup Website with Next.js and MongoDB.
The website has 4 pages and 3 API routes:
/
: where the user can see if they have logged in or not, and view all the other pages they can access/login
: a page where the user can login/signup
: the page where the user can signup for an account/profile
: where the user can check their account creation date/api/signup
: the API route where a user's account is created/api/login
: the API route where the password entered is checked/api/logout
: the API route where the username cookie is deleted
I have used cookies to check if the user has logged in.
The cookies are set and deleted in the /api
routes but read using getServerSideProps
.
The full source code can be viewed in this GitHub repo:
Login and Signup with Next.js
This template uses Next.js and MongoDB to create a simple login and signup website.
To use this template, simply fork the repo, and added your MongoDB URI to the .env
file with the key MONGODB_URI
.
To view the template in action, visit https://login-signup-nextjs.vercel.app
Can you check out the code and give me ways I can improve?
Original Link: https://dev.to/vulcanwm/login-and-signup-with-nextjs-am7
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To