This API provides the following features:
- 👤 User registration and login with JWT access tokens and token refreshing
- 📦 Product creation with image uploads to Cloudinary using Multer
- 🟢 Node.js
- 🟦 TypeScript
- 🔵 Express
- 🟡 MongoDB
- 🔑 JWT (JSON Web Tokens) for authentication
- ☁️ Cloudinary for image uploads
- 📁 Multer for handling file uploads
- Clone the repository
- Install dependencies using
npm install
- Set environment variables in a
.env
file based on the.env.example
file - Run the server using
npm start
POST /api/register
- Register a new userPOST /api/login
- Login as an existing user and receive a JWT access token and refresh tokenPOST /api/refresh
- Refresh the access token using the refresh token
(PROTECTED) POST /api/products
- Create a new product with an image upload to Cloudinary
That's it! This API provides a secure way for users to register, login, and create products with image uploads to Cloudinary. Feel free to use this code as a starting point for your own Node.js TypeScript APIs.