|
4 months ago | |
---|---|---|
cmd | 4 months ago | |
internal | 4 months ago | |
.gitignore | 4 months ago | |
LICENSE | 4 months ago | |
Makefile | 4 months ago | |
config.json | 4 months ago | |
doc.go | 4 months ago | |
go.mod | 4 months ago | |
go.sum | 4 months ago | |
item.go | 4 months ago | |
readme.md | 4 months ago | |
version.go | 4 months ago |
URL shortener service named after Rumia from Touhou 6: Embodiment of Scarlet Devil
Using CURL Generate shortener
$ curl -H "Content-Type: application/json" -X POST -d '{"url":"www.google.com"}' http://localhost:8080/encode/
<!-- Response: -->
<!-- {"success":true,"response":"http://localhost:8080/1"} -->
Redirect Open url in your browser http://localhost:8080/bN
OR
curl http://localhost:8080/1
Get info for url shortener\
curl http://localhost:8080/info/1
Response:
{
"success":true,
"response": {
"url":"www.google.com",
"visited":true,
"count":1
}
}
go install marisa.chaotic.ninja/rumia/cmd/rumia@latest
rumia requires PostgreSQL (>=10.0) to work properly.
createuser -P rumia
createdb -O rumia rumia_db
Add your config for the method of persistence and other options in file config.json
{
"server": {
"host": "0.0.0.0",
"port": "8080"
},
"options": {
"prefix": "http://localhost:8080/"
},
"postgres": {
"user": "rumia",
"password": "<password>",
"db": "rumia_db"
}
}