https://github.com/bineeshb/node-restapi-versioning
REST API multiple versions using Node.js, Express and TypeScript
https://github.com/bineeshb/node-restapi-versioning
expressjs morgan-middleware nodejs rest-api typescript
Last synced: about 2 months ago
JSON representation
REST API multiple versions using Node.js, Express and TypeScript
- Host: GitHub
- URL: https://github.com/bineeshb/node-restapi-versioning
- Owner: bineeshb
- Created: 2020-11-08T10:04:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-08T10:15:55.000Z (over 4 years ago)
- Last Synced: 2025-01-18T09:14:01.929Z (3 months ago)
- Topics: expressjs, morgan-middleware, nodejs, rest-api, typescript
- Language: TypeScript
- Homepage:
- Size: 342 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js REST API versioning
REST API multiple versions using Node.js, Express and TypeScript### Get Started
Requires Node 10+1. `npm i` - Install dependencies
2. Start server
- `npm run dev` - Start server in development mode
- `npm run start` - Start server in production mode
3. Server runs in `http://localhost:3000`### API Endpoints
| Endpoints | Methods |
| --- | --- |
| `/api/v1/parse` | POST |
| `/api/v2/parse` | POST |### Sample Request & Response
#### Request
```json
// HTTP Method: POST
{
"data": "JOHN0000MICHAEL0009994567"
}
```#### Response
- from /api/v1/parse
```json
{
"statusCode": 200,
"data": {
"firstName": "JOHN0000",
"lastName": "MICHAEL000",
"clientId": "9994567"
}
}
```- from /api/v2/parse
```json
{
"statusCode": 200,
"data": {
"firstName": "JOHN",
"lastName": "MICHAEL",
"clientId": "999-4567"
}
}
```Note: Test screenshots in folder `/screenshots`.