A robust REST API built with Express.js and TypeScript that manages product changelogs.
- Runtime: Node.js
- Framework: Express.js
- Language: TypeScript
- Database: PostgreSQL with Prisma ORM
- Authentication: JWT
- Testing: Jest & Supertest
- Validation: Express Validator
- Logging: Morgan
-
π Authentication & Authorization
- JWT-based authentication
- Password hashing with bcrypt
- Protected routes with middleware
- User-specific data access control
-
π Resource Management
- Products CRUD operations
- Changelog updates with versioning
- Update points for detailed tracking
- Nested resource relationships
-
π‘οΈ Input Validation & Error Handling
- Request body validation
- Custom error handling middleware
- Typed request/response with TypeScript
- Structured error responses
-
π― API Design
- RESTful principles
- Resource nesting
- Query parameter support
- Status code best practices
POST /register # Create new user account
POST /signin # Authenticate user and get token
GET /api/product # List all products
POST /api/product # Create new product
GET /api/product/:id # Get product details
PATCH /api/product/:id # Update product
DELETE /api/product/:id # Delete product
GET /api/product/:p_id/update # List updates
POST /api/product/:p_id/update # Create update
GET /api/product/:p_id/update/:u_id # Get update
PATCH /api/product/:p_id/update/:u_id # Modify update
DELETE /api/product/:p_id/update/:u_id # Delete update
-
Clone repository:
git clone <repository-url>
-
Install dependencies:
pnpm install
-
Set up environment:
cp .env.example .env # Edit .env with your database credentials
-
Initialize database:
pnpm prisma migrate dev
-
Start development server:
pnpm dev
Run the test suite:
pnpm test
ISC