main.js 638 B

123456789101112131415161718
  1. (function () {
  2. var web = require('glagol-web')
  3. , resolve = require('path').resolve.bind(null, __dirname)
  4. , options = { formats: { '.styl': require('glagol-stylus')() } }
  5. , server = web.server($.options.server.host, $.options.server.port,
  6. [ web.route('/', web.app(options, resolve('../client'), resolve('../common')))
  7. , web.route('/upload', _.upload) ]);
  8. server.http.on('listening', function () {
  9. console.log('open ' + $.options.server.host + ':' + $.options.server.port +
  10. ' in your browser')
  11. })
  12. server.sockets.on("connection", function (socket) { $.connect(socket) });
  13. return server;
  14. })