Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thesaintkappa/linksnip
A URL shortening service built with Express & Redis
https://github.com/thesaintkappa/linksnip
express express-api express-js expressjs link-shortener link-shortener-api redis ts typescript url-shortener
Last synced: 2 days ago
JSON representation
A URL shortening service built with Express & Redis
- Host: GitHub
- URL: https://github.com/thesaintkappa/linksnip
- Owner: theSaintKappa
- License: bsd-2-clause
- Created: 2023-03-03T22:55:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-11T18:40:09.000Z (8 months ago)
- Last Synced: 2024-10-11T12:11:41.940Z (about 1 month ago)
- Topics: express, express-api, express-js, expressjs, link-shortener, link-shortener-api, redis, ts, typescript, url-shortener
- Language: TypeScript
- Homepage: https://link.saintkappa.dev
- Size: 272 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LinkSnip
### Snip your long URLs in the snap of a finger! https://link.saintkappa.dev
> ➡️ Add `?json` to the end of a sniped url to get the raw json response instead of being redirected.
## Installation & Running
- Clone this repository
- Run```bash
$ npm install
$ cd public
$ npm install
$ npm run build
$ cd ../
```- Create a `.env` file in the root directory and add the following:
```env
REDIS_URI=[your redis connection URL]
APP_URL=[your public app url]
```- Install nodemon globally with `npm install -g nodemon`
- Run `npm run dev` to start the app locally## API
### POST /api/new
#### Request headers:
```
Content-Type: application/json;
```#### Request body (JSON):
```js
{ "url": "example.com" }
// Note: if you don't provide a url protocol, your snip will default to https
```#### Example response:
```json
{
"snipId": "DjX",
"snipUrl": "https://link.saintkappa.dev/DjX",
"redirectUrl": "https://github.com/theSaintKappa",
"createdAt": "2023-08-24T22:24:59.096Z",
"alreadyExisted": true
}
```#### Example request:
```bash
$ curl --request POST \
https://link.saintkappa.dev/api/new \
--header 'Content-Type: application/json' \
--data '{ "url": "https://github.com/theSaintKappa" }'
```