URL-Shortener service is providing APIs to make url short. It has two endpoints, /encode and /decode.
-/encode endpoint will accept a url and return back it’s encoded form -/decode endpoint will accept encoded-url and return back it's original form
We are using Node.js with Typescript to create APIs. To generate API routes we are using the express.js framework. For code validation, we are using eslint. To make a bug-free app, we should have unit, integration and end-to-end testing. For the test, we are using jest and supertest. To generate API docs and test APIs by manual we are using Swagger. To manage and store logs effectively we are using pino. For schema level validations we are using joi . To make the dev process easy we are using nodemon. To manage different environments we are using dotenv
- Install all dependencies :
npm install
- Start server:
npm run start
- or Start server in Dev mode :
npm run dev
- Swagger doc will be avialable at http://localhost:3000/api-docs
- To run all tests :
npm run test
- To get tests coverage
test:coverage
- To run all integration tests :
npm run test:integration
- To run all end-to-end tests :
npm run end-to-end
- To build app :
npm run build
- To start server:
npm run start
- Swagger doc will be avialable at http://localhost:3000/api-docs
Before going to production please don't forget to update .env.production file with correct production env values