Skip to content

A simple and quick link shortener, with an integrated API for remote access.

License

Notifications You must be signed in to change notification settings

lumaa-dev/DesirePath

Repository files navigation

Desire Path

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.

Cache

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.

API

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.

Available Requests

GET /api/links

This does not need any parameters, but does need the Authorization from the config.json file.

Returns:

[
    {
        "id": "URL_ID",
        "url": "https://example.com/"
    },
    ...
]

GET /api/link

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/"
}

POST /api/link

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

DELETE /api/link

This requires the id query, and does need the Authorization.

Returns: Success

Issues

  • 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.

License

Desire Path © 2024 by Lumaa is licensed under Creative Commons Attribution-NoDerivatives 4.0 International

About

A simple and quick link shortener, with an integrated API for remote access.

Topics

Resources

License

Stars

Watchers

Forks