Skip to content
This repository has been archived by the owner. It is now read-only.

InCodeDevs/URLShorter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@incodelang/urlshorter

Merged into InCodeDevs/InCode

A simple way to short urls

Installation

Install @incodelang/urlshorter with npm

  npm install @incodelang/urlshorter

Install @incodelang/urlshorter with yarn

  yarn add @incodelang/urlshorter

Usage/Examples

Integrate in your own express.js application

const { urlServer } = require('@incodelang/urlshorter')
const express = require('express')

const app = express();

app.listen(3000, "0.0.0.0");

urlServer({
    app: app,
    prefix: "app" // prefix of the shorted urls
})

Standalone express.js application

const { urlServer, sampleApp } = require('@incodelang/urlshorter')

urlServer({
    app: sampleApp(
        3000, // port [default] = 3000
        "0.0.0.0" // host [default] = "0.0.0.0"
    ),
    prefix: "app" // prefix of the shorted urls
})

API Reference

Create Link

  GET /api/v1/url/create
Parameter Type Description
target string The url target

Returns a JSON Object with the fields error, message and id

View shorted URL

  GET /{prefix}/{id}

Authors

License

GPL-3.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published