daily pastebin goal
84%
SHARE
TWEET

Untitled

a guest Sep 25th, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Module dependencies.
  3.  */
  4.  
  5. var express = require('express')
  6.   , routes = require('./routes')
  7.   , i18n = require("i18n")
  8.   , socketio = require("socket.io");
  9.  
  10. var app = module.exports = express.createServer();
  11. socketio.listen(app)
  12.  
  13. // Configuration
  14.  
  15. app.configure(function(){
  16.   app.set('views', __dirname + '/views');
  17.   app.set('view engine', 'jade');
  18.   app.use(express.bodyParser());
  19.   app.use(express.methodOverride());
  20.   app.use(app.router);
  21.   app.use(express.static(__dirname + '/public'));
  22. });
  23.  
  24. app.configure('development', function(){
  25.   app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
  26. });
  27.  
  28. app.configure('production', function(){
  29.   app.use(express.errorHandler());
  30. });
  31.  
  32. i18n.configure({
  33.     locales:['es'],
  34. });
  35.  
  36. i18n.setLocale('es');
  37.  
  38. app.helpers({
  39.   __i: i18n.__,
  40.   __n: i18n.__n
  41. });
  42.  
  43. // Sockets
  44.  
  45. socketio.sockets.on('connection', function(socket) {
  46.     socket.emit('chart-data', {data: [[1,5], [2,10], [3,15], [4,20], [5,25]]});
  47. });
  48. // Routes
  49.  
  50. app.get('/', routes.index);
  51.  
  52. app.listen(3000);
  53.  
  54. console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top