mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:03:30 +02:00
Rename "roles" to "units". Put units in their own folders.
This commit is contained in:
29
lib/units/device/support/http.js
Normal file
29
lib/units/device/support/http.js
Normal file
@@ -0,0 +1,29 @@
|
||||
var http = require('http')
|
||||
var util = require('util')
|
||||
|
||||
var syrup = require('syrup')
|
||||
var express = require('express')
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.define(function(options) {
|
||||
var log = logger.createLogger('device:support:http')
|
||||
, port = options.ports.pop()
|
||||
, app = express()
|
||||
, server = http.createServer(app)
|
||||
|
||||
app.set('strict routing', true)
|
||||
app.set('case sensitive routing', true)
|
||||
app.set('public url', util.format(
|
||||
'http://%s:%s'
|
||||
, options.publicIp
|
||||
, port
|
||||
))
|
||||
|
||||
server.listen(port)
|
||||
|
||||
log.info('Listening on %s', app.get('public url'))
|
||||
|
||||
return app
|
||||
})
|
||||
Reference in New Issue
Block a user