You need to create .env
file for development and put these variables there (but with real values)
POSTGRES_PASSWORD=db_password
POSTGRES_USER=db_user
POSTGRES_DB=db_name
DATABASE_HOST=localhost
REDIS_HOST=localhost
REDIS_PORT=6379
For development file called - .env
For production - .env.production
make dev
this will start database and redis. After that, you need to manually run go run main.go
make build
make start
Returns all urls from database
Creates new url
{
"url": "https://github.com",
"name": "gh",
"auto_delete": 30
}
name
and auto_delete
are optional.
auto_delete
should be a number in minutes.
Returns url object by its short id
Deletes url by its id
Finds url by shortId and redirects to long url