Skip to content

exnext/shortlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShortLink

ShortLink is a simple service to make tiny url. It is excellent solution in internal network. It works based main on expressjs and sequelize modules with sqlite3.

Startup

git clone https://github.com/exnext/shortlink.git
cd shortlink
npm install

npm start
#or
node shortlink.js

User inrerface

You can build yours own web page to use the shortlink service or can use added example. Our example has based on VUE framework. Change our logo for yours and have fun full functionality service.

On web browser set url address served by the shortlink (e.g http://localhost:8080). Shortlink service should redirect you to path /add.

Default configuration

Default values are defined in shortlink.js. Each value can be overridden by config.json file.

{
    port: 8080,
    address: "localhost",
    database: "./shortlink.db"
}

Custom configuration

You can override part or all default values (e.g change port or database). You have to create file config.json contains overrides values.

{
    "port": 8001,
    "address": "0.0.0.0",
    "database": "./file.db"
}
{
    "port": 8002,
    "database": ":memory:"
}

reCAPTCHA v2

The service supports reCAPTCHA. You have to set fields into config.json to enable feature. The solution has used recaptcha-verify module.

{
    "recaptcha": {
        "siteKey": "YOUR SITE KEY",
        "secretKey": "YOUR SECRET KEY"
    }
}

Linux configuration

Below are examples to configurations for apache and linux service

Apache

<VirtualHost *:80>
    ServerName YOUR-DOMAIN
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    ProxyPreserveHost On
    ProxyRequests Off
</VirtualHost>

Nginx

server {
   listen 80;
   server_name YOUR-DOMAIN;

   location / {
      proxy_pass http://localhost:8080/;
   }
} 

Service

Save configuration from below example to /lib/systemd/system/shortlink.service. Change YOUR-PATH before...

[Unit]
Description=shortlink service
After=network-online.target

[Service]
Restart=on-failure
WorkingDirectory=/YOUR-PATH/shortlink/
ExecStart=/usr/bin/node /YOUR-PATH/shortlink/shortlink.js

[Install]
WantedBy=multi-user.target

...and next execute commands

systemctl daemon-reload
systemctl enable shortlink
systemctl restart shortlink

Demo

Here is Live demo with restrictions. Project from github works with full functionality.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published