项目
在 GitHub 查看 
bradtraversy/mern-auth
关于
MERN authentication using JWT and HTTP-Only cookie
安全与隐私实测星标增长
- 24小时
- 0
- 7天
- +1
- 15天
- +2
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文MERN Authentication Starter
This is a starter app for a MERN stack application with authentication. This is for a SPA (Single Page Application) workflow that uses the Vite Build tool. This authentication workflow is based off of my MERN Stack From Scratch | eCommerce course.

It includes the following:
- Backend API with Express & MongoDB
- Routes for auth, logout, register, profile, update profile
- JWT authentication stored in HTTP-only cookie
- Protected routes and endpoints
- Custom middleware to check JSON web token and store in cookie
- Custom error middleware
- React frontend to register, login, logout, view profile, and update profile
- React Bootstrap UI library
- React Toastify notifications
Usage
- Create a MongoDB database and obtain your
MongoDB URI- MongoDB Atlas - Create a PayPal account and obtain your
Client ID- PayPal Developer
Env Variables
Rename the .env.example file to .env and add the following
NODE_ENV = development
PORT = 5000
MONGO_URI = your mongodb uri
JWT_SECRET = 'abc123'
Change the JWT_SECRET to what you want
Install Dependencies (frontend & backend)
npm install
cd frontend
npm install
Run
# Run frontend (:3000) & backend (:5000)
npm run dev
# Run backend only
npm run server
Build & Deploy
# Create frontend prod build
cd frontend
npm run build
探索相关项目
加载中…