management_subdomain
v1.0.8
Published
module for managements express apps and subdomains
Downloads
4
Maintainers
Readme
MANAGEMENT EXPRESS APP AND SUBDOMAINS
With this package you can create a http server or https server with express and redirect yours request in many subdomains
Installation
Use the package manager yarn or npm to install the module.
Yarn
yarn add -s management_subdomain
npm
npm i -s management_subdomain
Usage
ES6
import { createServer } from 'management_subdomain'
import { join } from 'path'
// Intance server with absolute path for new folders
const server = createServer({
sites = join(__dirname, 'sites'), // folder for express apps
ssl = join(__dirname, 'ssl'), // folder for ssl certificates with names fullchain and privkey.pem
domainsInfo = [{ folder: "default", url: "test.localhost" }] // name of folder in sites, this contains express app
})
// Server listen on port 80 (http)
server.listenHttp()
// Or listen on port 443 (https)
server.listenHttps()
ES2015
const { createServer } = require('management_subdomain')
const { join } = require('path')
// Intance server with absolute path for new folders
const server = createServer({
sites = join(__dirname, 'sites'), // folder for express apps
ssl = join(__dirname, 'ssl'), // folder for ssl certificates with names fullchain and privkey.pem
domainsInfo = [{ folder: "default", url: "test.localhost" }] // name of folder in sites, this contains express app
})
// Server listen on port 80 (http)
server.listenHttp()
// Or listen on port 443 (https)
server.listenHttps()