A simple Postgres backed URL Shortener API made using Django REST Framework.
A single shortenedURL in JSON looks as:
{
"created": "2021-07-14T20:06:35.314848+05:30",
"long_url": "https://yaifoundation.org",
"short_url": "site",
"times_visited": 32
}| Endpoint | Request | Response |
|---|---|---|
/ |
GET | Status of API. |
/urls/ |
GET | Array of shortenedURL Objects |
| POST | Create a shortened URL | |
/v/<ShortURL> |
GET | Get particular shortenedURL object |
| PUT | Update an existing shortenedURL object | |
| DELETE | Delete an existing shortenedURL object |
| Variable | Required | Default | Description |
|---|---|---|---|
| SECRET_KEY | ☑ | None | This value is the key to securing signed data – it is vital you keep this secure, or attackers could use it to generate their own signed values. |
| DATABASE_URL | ☑ | None | The valid Postgres Connection URI |
| HOSTS | ☐ | None | A space-separated list of hosts supported by the Django App. |
| DISABLE_COLLECTSTATIC | ☐ | None | Set to 1 to disable collectstatic. |