A simple backend application that creates short URLs based on long URLs provided by the user. The service is built using TypeScript, Node.js, and Express.
- Create short URLs based on long URLs
- Redirect to the long URL when accessing the short URL
- API documentation with Swagger UI
url-shortener/
│
├── src/
│ ├── __tests__/
│ │ └── services/
│ │ │ └── ShortUrlService.test.ts
│ ├── controllers/
│ │ └── ShortUrlController.ts
│ ├── services/
│ │ │ └── ShortUrlService.ts
│ ├── application.ts
│ └── server.ts
├── package.json
└── tsconfig.json
- Node.js (v14 or newer)
-
Clone the repository
-
Install the dependencies:
cd url-shortener
npm install
To start the development server, run:
npm run dev
The server will start on port 3000. You can access the API documentation at http://localhost:3000/docs.
To run the unit tests, use the following command:
npm jest
- POST
/short-url
- Create a short URL from the provided long URL - GET
/{id}
- Redirect to the long URL associated with the provided tiny URL ID
This project is licensed under the MIT License.