Desire Path is a project that serves as a link shortener, developed using NodeJS. The term "Desire Path" references the concept of desire paths — informal trails created as people repeatedly take preferred routes rather than the official paths provided. This analogy is fitting for a link shortener, as it creates the most direct and efficient way to access web content.
Before filling a new GitHub issue, please see if it isn't already mentionned in the Issues section.
This link shortener contains a cache, it is unaccessible directly but, the cache adds a redirection when the API calls one or when someone gets redirected.
If your database does not work or crashes, the cache will take the torch, and redirect the users to the cached link.
The cache gets cleared when this program stops or crashes.
Desire Path also provides a small but leverageable API for a remote access to the database. Most of the request need to use the Authorization used in the config.json file, except the GET /api/link request.
- GET /api/links - Get all the existing redirections
- GET /api/link - Get a specific redirection using an
id
- POST /api/link - Create a new redirection using a
url
and, optionally, anid
- DELETE /api/link - Delete a redirection using an
id
This does not need any parameters, but does need the Authorization from the config.json file.
Returns:
[
{
"id": "URL_ID",
"url": "https://example.com/"
},
...
]
This requires the id
query used as such /api/link?id=[URL_ID]
, and does not need the Authorization.
Returns:
{
"id": "URL_ID",
"url": "https://example.com/"
}
This requires the url
and optionally the id
parameters in the body of the request, and does need the Authorization.
If you do not provide an id
parameter, then Desire Path will create a 6 character code using only letters both lowercase and uppercase. Which makes a 0.00000000506% of having duplicates.
Returns: Created /[URL_ID] redirection
This requires the id
query, and does need the Authorization.
Returns: Success
- It is possible to be redirected to a URL even though only the last component matches.
- Currently, it is possible to create 2 redirections that uses the same
id
, which will be fixed later.
Desire Path © 2024 by Lumaa is licensed under Creative Commons Attribution-NoDerivatives 4.0 International