Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mauriciogirardi/api-short-links
Create short links
https://github.com/mauriciogirardi/api-short-links
Last synced: about 12 hours ago
JSON representation
Create short links
- Host: GitHub
- URL: https://github.com/mauriciogirardi/api-short-links
- Owner: mauriciogirardi
- Created: 2024-03-23T14:13:39.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-23T14:26:01.000Z (8 months ago)
- Last Synced: 2024-03-23T15:31:27.877Z (8 months ago)
- Language: TypeScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## API SHORT LINK
## Technologies
- Node.js
- Typescript
- Postgresql
- Redis
- Fastify
- Zod
- Docker### endpoints
```bash
## POST create link
http://localhost:3333/api/links# body
{
"code": "test4",
"url": "https://www.github.com/mauriciogirardi"
}## return
{
"shortLinkId": 7
}
``````bash
## GET linkshttp://localhost:3333/api/links
## return
"links": [
{
"id": 6,
"code": "test1",
"original_url": "https://www.github.com/mauriciogirardi",
"create_at": "2024-03-23T13:49:43.969Z"
},
{
"id": 5,
"code": "test2",
"original_url": "https://www.gitub.com/mauriciogirardi",
"create_at": "2024-03-23T13:36:50.772Z"
},
{
"id": 1,
"code": "test3",
"original_url": "https://www.gitub.com/mauriciogirardi",
"create_at": "2024-03-23T13:10:36.786Z"
}
]
``````bash
## GET short link
http://localhost:3333/test2## redirect to
https://www.github.com/mauriciogirardi
``````bash
## GET metrics
http://localhost:3333/api/metrics## return
{
"metrics": [
{
"shortLinkId": 6,
"clicks": 2
}
]
}
```