smart-home
Version:
Netbeast dashboard, IoT apps manager
31 lines (24 loc) • 822 B
JavaScript
// server.js
// ==========
/*
* This is where all the magic happens.
* The Netbeast dashboard calls this script as is
* `node server.js --port <free port number>`
* after that everyline here will be executed.
*
* You can install extra modules thanks to the work
* of npm. Also you can create a shell script to
* install any missing system package.
*/
/* Requires node.js libraries */
var express = require('express')
var app = express()
// Netbeast apps need to accept the port to be launched by parameters
var argv = require('minimist')(process.argv.slice(2))
app.use(express.static('public'))
var server = app.listen(argv.port || 31416, function () {
var host = server.address().address
var port = server.address().port
console.log('Example app listening at http://%s:%s', host, port)
})