This is NodeJS, Express, TypeScript project.
$ npm install
There are two ways how to run the application.
- Development mode
$ npm run dev
- Production mode
$ npm run build
$ node dist/index.js
Get request returns status to see if an application is running
{
"data": {
"status": "online"
}
}
Get request returns payload given shortUrl
matches long URL
{
"data": {
"url": "http://www.example.com",
"status": "success"
}
}
Post request for generating short URL
Request payload
{
"data": {
"url": "http://www.example.com"
}
}
Response payload
{
"data": {
"status": "completed",
"url": $SHORT_URL
}
}