Coder Social home page Coder Social logo

nodeproxy's Introduction

Proxying node app template

TL;DR

npm i
npm start
### after done testing
npm run killall

The long story

This is a quick and dirty template to run different nodejs apps from one location. There are two sample projects hello1 and hello2. These can be anything and do not have to be in the same folder. These would be started by something similar to supervisord, but for this project, they'll be started by the main npm scripts. Here's a list of the aforementioned scripts:

  • startone
  • killone
  • starttwo
  • killtwo
  • start
  • killall

The sample projects also have a few scripts, which don't really matter for this project, but for completeness, they are start and dev for both.

For each sample project, as well as the main project, you can specify which port the application shows up by putting it in their respective port file.

To add additional applications, add another app.use() line to the main project index.js. For example:

# app.use('<location>', proxy('localhost:<port #>'))

  app.use('/newapp', proxy('localhost:30000'))

Just be sure that the main proxy application doesn't have a conflicting location in its ./routes.js. Now, it is setup to serve two files, index.html and a 404.html document when it can't find anything to serve.

nodeproxy's People

Contributors

wdolorito avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.