https://github.com/prma85/url-shortener-microservice
An open-source URL shortener micro-service (REST). Created using MongoDB, ExpressJS, NodeJS and Typescript. Can be deployed using docker or serverless architecture.
https://github.com/prma85/url-shortener-microservice
nodejs serverless url-shortener url-shortener-microservice
Last synced: about 1 month ago
JSON representation
An open-source URL shortener micro-service (REST). Created using MongoDB, ExpressJS, NodeJS and Typescript. Can be deployed using docker or serverless architecture.
- Host: GitHub
- URL: https://github.com/prma85/url-shortener-microservice
- Owner: prma85
- License: mit
- Created: 2021-10-21T19:38:27.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-21T20:40:50.000Z (over 4 years ago)
- Last Synced: 2025-03-26T18:54:42.843Z (over 1 year ago)
- Topics: nodejs, serverless, url-shortener, url-shortener-microservice
- Language: TypeScript
- Homepage:
- Size: 334 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# URL Shortener - API
Service responsible for the URL shortener
## Setup
### Local Setup
## Rest API
### POST / (Create)
create a new URL based on originalUrl
#### Request
```json
{
"full": "https://www.yoursite.com/your-path/your-page"
}
```
#### Response
```json
{
"status": true,
"data": {
"uuid": "0b354e7c-3d7a-4a42-94ea-135e7d20cd7d",
"short": "hRYzMtjx",
"full": "https://www.yoursite.com/your-path/your-page",
"createdAt": "2020-07-30T21:37:16.321Z",
"clicks": 0
}
}
```
### GET /{CODE} (Open URL)
Open the originalUrl based on code
#### Request
```
GET http://localhost:3000/hRYzMtjx
```
#### Response
```
It redirects to the originalUrl
```
## Deploy
This service is using AWS lambda with the serveless Caludia
### Configure your AWS access credentials
To accomplish this you need to:
- Create an AWS profile with IAM full access, Lambda full access and API Gateway Administrator privileges.
- Add the keys to your .aws/credentials file:
```text
[default]
aws_access_key_id = YOUR_ACCESS_KEY
aws_secret_access_key = YOUR_ACCESS_SECRET
```