notification-server
Version:
Based on NowJS, a standalone server for sending and receiving notification across different live users
52 lines (40 loc) • 1.22 kB
text/coffeescript
util = require 'util'
optparse = require 'optparse'
core = require '../lib/notification-server'
switches = exports.switches = [
['-h', '--help', 'Print this'],
['-p', '--port NUMBER', 'Notification Server Port'],
['-H', '--host TEXT', 'Notification Server Host'],
['-f', '--forever', 'Show forever executable code']
]
class Processor
constructor: () ->
= {
host: '0.0.0.0',
daemon: false
}
= new optparse.OptionParser(switches)
.banner = 'Usage: notification-server -p <Port>';
()
_configureParser: ->
.on 'port', (k, value) =>
.port = value
.on 'host', (k, value) =>
.host = value
.on 'daemon', =>
.daemon = true
.on 'help', =>
util.puts
.on 'forever', =>
util.puts "forever start notification-server -H localhost -p 2212"
run: ->
.parse()
console.log util.inspect()
if typeof(.port) == 'undefined'
util.puts
else
= new core.NotificationServer()
.start();
getServer: ->
exports.Processor = Processor