metro-http
v1.0.6
Published
Simple http server for LightningJS Apps
Downloads
3
Readme
Node http server for LightningJS
Simple to use stand alone node HTTP Server
cli
$ sudo npm i -g metro-http
//start a metro-http from the current directory on the default port 8080
$ metro-http
You can modify any of the config keys by passing their key value pairs as args.
//start a metro-http from the current directory on port 3000 and start browser
$ metro-http port=3000 open=true
writing a node http server
const server=require('metro-http')
server.start({
host: '0.0.0.0'
port: 3000,
open: true, // Open default browser
dir: '~/path_to_website',
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin'
}
}, callback);
function callback (server) {
// the server has started
}
cors
Boolean - default false. True will allow cors with wildcard.
port
Number - Specifies on which port the website is served, when port is occupied it auto-increments. Default is 8080
open
Boolean - True will automatically open the served website in your default browser. Default false.
dir
String - directory path where the website is located. Defaults to metro-http test page.
watch
Boolean - defining if the directory should be watched. If True the browser will Reload the page. Default false