Skip to content

we-lib/app-mounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

app-mounter

Mount your apps onto one server

Idea

I wanted to mount different express apps onto one server, each with it's prefix path. And I did't know how, so I created this.

Usage

Create an app:

// app1.js
var express = require('app-mounter/express')
var app = express()
app.get('/hello', function(req, res){
  res.send('hello')
})
module.exports = app

Mount an app in the main-app:

// main-app.js
var Mounter = require('app-mounter')
var mounter = new Mounter()
mounter.mount('/app1', require('./app1'))
// Gonna mount more apps..
var server = mounter.listen(80, function(err){
  // Check http://localhost/app1/hello
  // --> hello
})

About

Mount your apps onto one server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published