( अल्प ) — A fast ⚡ self-hosted link 🔗 shortener.
This is the core of the project, it the RESTful API that performs redirection, communicates with the database and provides alpa it's functionality.
Refer to the config example file for all possible configuration keys, and their detailed explanation. If you still have any doubts, feel free to shoot a tweet at me @vsnthdev.
Method | Path | Description | Protected |
---|---|---|---|
POST |
/api/auth/login |
Takes username, password and responds with a JWT token. | ❌ |
DELETE |
/api/auth/logout |
Blacklists the token until expired to prevent usage. | ❌ |
GET |
/:code & / |
Redirects if short code is found or returns 404. | ❌ |
DELETE |
/api/codes/:code |
Deletes a short code from the database. | ❌ |
GET |
/api/codes |
List out all short codes with pagination. | ❌ |
POST |
/api/codes |
Creates a new short code. | ❌ |
POST |
/api/config |
Creates, updates an existing, or deletes configuration. | ❌ |
You need to be at least on Node.js v17.4.0 or above and follow the below instructions to build this project 👇
- STEP 1️⃣ Clone this repository & enter into it (
cd ./alpa
) - STEP 2️⃣ Run
npm install
to get all dependencies & link projects together - STEP 3️⃣ Enter in the project directory (
cd api
) - STEP 4️⃣ To build this project run
npm run build
Upon building @alpa/api
a dist
folder is created with the transpiled JavaScript files.
The alpa project is released under the AGPL-3.0-only.
Developed & maintained By Vasanth Srivatsa. Copyright 2022 © Vasanth Developer.
vsnth.dev · YouTube @vasanthdeveloper · Twitter @vsnthdev · Discord Vasanth Developer