15ms-router

    2.0.0 • Public • Published

    15ms-router

    A short link server.

    Usage

    install as dependency

    npm install --save 15ms-router@latest

    use API to start server

    const jumpServer = require('15ms-router');
     
    jumpServer({
      name: 'YOUR-APP-NAME',
      secure: {
        public: '', // optional: public key file
        private: '', // only for debug, private key file
      },
      router: {
        rootdir: 'data-dir', // optional: local data directory
        cache: {}, // optional: lru-cache options
      },
      remote: {
        connect: 'mysql://', // mysql connect string
      }
    });

    call server HTTP APIs

    var secure = new Secure({
      private: ''
    });
    /*
    sign(
      HEX,
      SHA256,
      JSON({ verb, data, time = YYYY-MM-DD HH:mm })
    )
    */
     
    var payload = {
      verb: 'action',
      data: {},
      hash: secure.createHash(verb, data)
    }
     
    fetch('http://15ms', {
      method: 'POST',
      headers: {
        'content-type': 'application/json'
      },
      body: JSON.stringify(payload)
    });

    action: bind

    { name, href, code }

    action: kill

    { name, code }

    action: find

    { name }

    action: list

    { }

    access to short link

    Open http://15ms/your-link and redirect to target.

    Install

    npm i 15ms-router

    DownloadsWeekly Downloads

    10

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    12.9 kB

    Total Files

    11

    Last publish

    Collaborators

    • sartrey