A Node.js backend for a Dnd shop application, built with Express, MongoDB, and JWT authentication. This project serves as a learning tool for Node.js and custom authentication implementation.
- User authentication (JWT-based)
- CRUD operations for shops
- Token validation middleware
- MongoDB for data persistence
- Clone the repository
- npm install
NODE_ENV
: Environment (development
,production
, etc.)PORT
: Server portMONGO_URI
: MongoDB connection stringACCESS_TOKEN_SECRET
: Secret for signing access tokensREFRESH_TOKEN_SECRET
: Secret for signing refresh tokens
- Development: npm run dev
- Production: npm run build npm start
POST /api/auth/signup
- SignupPOST /api/auth/login
- LoginPOST /api/auth/refresh
- Refresh token
POST /api/shop/new
- Create a new shop (requires access token)GET /api/shop/all
- Get all shopsGET /api/shop/user
- Get shops of the authenticated userGET /api/shop/:id
- Get shop by IDDELETE /api/shop/delete/:id
- Delete shopPATCH /api/shop/update/:id
- Update shop