https://github.com/shikaan/wayne
Minimalistic URL Short(en)er
https://github.com/shikaan/wayne
firebase go poc
Last synced: 3 months ago
JSON representation
Minimalistic URL Short(en)er
- Host: GitHub
- URL: https://github.com/shikaan/wayne
- Owner: shikaan
- Created: 2019-07-14T07:59:15.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-15T20:21:31.000Z (almost 7 years ago)
- Last Synced: 2025-02-13T08:18:11.717Z (over 1 year ago)
- Topics: firebase, go, poc
- Language: Go
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Wayne
===
Minimalistic URL Short(en)er
> [Here](https://www.youtube.com/watch?v=0PQKnjwlN6g) if you don't get the pun.
## :warning: Disclaimer
This is my first experiment in Go. The software itself is still garbage: buggy,
poorly designed and what not. It's just my first attempt to get my hands dirty.
I gave it a fancy name so I am more motivated to keep it going.
## How does it work?
This application exposes three endpoints:
```
POST /api/urls
Request:
{
"readableHash": string,
"targetURL" : string
}
Response:
* 201 - Created
{
"id" : string,
"readableHash": string,
"targetURL" : string
}
```
```
GET /api/urls
Response:
* 200 - OK
[
{
"id" : string
"readableHash": string,
"targetURL" : string
}
]
```
```
GET /${readableHash}
Response:
* 301 - Moved Permanently
```
The first two endpoints are normal CRUD operation: create and list URLs.
URLs are stored in a Firebase Database and the application expects a `firebase_auth.json` in the root directory to be able to work.
The database has to have a collection called `urls` whose elements are exactly as you see in the payloads above.
Once you have created a URL with a readable hash, you can use such hash and hit `localhost:8080/${readableHash}` to be redirected to the `targetURL`.
## Getting started
Copy the Firebase service account JSON file in the root directory with the name "firebase_auth.json" and then
```
make start
```