Skip to content

nrjais/harbour

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harbour-Server

This is a tunnel server that can be used to route the http requests to your localhost server using harbour-client that will be running on your local machine.

Installation

$ npm install harbour-server --save

Usage

Server-Side

This needs to run on public domain server.

const Harbour = require('harbour-server');
const http = require('http');

const PORT = 80;

const server = http.createServer(function (req, res) {
  /**
   * this function can be called whenever the request
   * is needed to be transferred to the server running on your
   * local machine.
  */
  requestRouter(req, res);
});

const harbour = new Harbour();
const requestRouter = harbour.createRouter(server);

server.listen(PORT);
console.log(`listening on PORT ${PORT}`);

Local Machine

To route all your requests to localhost a client is needed that can be installed by

$ npm install -g harbour-client

After installing run this command on command-line.

$ harbour www.example.com localhost-port

localhost-port is the on which the local server is running.

Example

$ harbour www.example.com 8000

Now all http requests coming to www.example.com will be routed to localhost:8000

About

localhost server tunneling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published