module
Version:
v0.0.0-...-ce4d510
Opens a new window with list of versions in this module.
Published: Aug 31, 2024
License: MIT
Opens a new window with license information.
README
¶
Description:
Rest API for shortening urls
Self-hosting instructions:
- Clone the repository
- Install dependencies
go mod download
- Run the server
make run
- Run the tests
make tests
Save alias
Delete alias
Go to the shortcut link
Features:
- Redirect to the original url by the short url
- If alias is not provided, generate a random alias
- Creating, deleting urls are protected by auth
- To store data use sqlite database
- Api tries to decode json body, if it fails, returns
failed to parse request
message
- Validates incoming requests
- Logs all requests in text format in dev environment, and in json format in prod environment
- Saving existing url, returns the same name message
- Fails if alias is invalid
- Fails if URL for given alias not found
- Redirect only if successfully got URL
Tests shows that api works correctly
Directories
¶
Click to show internal directories.
Click to hide internal directories.