magicDemo.js 599 B

1234567891011121314151617
  1. var http = require('http'),
  2. session = require('./lib/core').magicSession(),
  3. eyes = require('eyes');
  4. // let's create a basic http server!
  5. http.createServer(function (request, response) {
  6. // after the session middleware has executed, let's finish processing the request
  7. response.writeHead(200, {'Content-Type': 'text/plain'});
  8. response.write('hello, i know nodejitsu. \n' + 'the current session for this request looks like: \n' + JSON.stringify(request.session, 2, true));
  9. response.end();
  10. }).listen(8080);
  11. /* server started */
  12. console.log('> hello world running on port 8080');