Guest User

Untitled

a guest
Jun 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. var path = require('path'),
  2. fs = require('fs'),
  3. express = require('express'),
  4. YUI = require('yui3').YUI;
  5.  
  6. var app = module.exports = express.createServer();
  7.  
  8. YUI({
  9. debug: true
  10. }).use('dump', 'node', 'express', function(Y){
  11.  
  12. app.configure(function(){
  13. app.set('views', process.cwd());
  14. app.use(express.logger());
  15. app.use(app.router);
  16. });
  17.  
  18. app.register('.html', YUI);
  19.  
  20. Y.log("Hello World!");
  21. Y.log(Y.dump({hello: 'world'}));
  22.  
  23. app.get('/log', function(req, res, next){
  24. Y.log('app.get log');
  25. Y.log(Y.dump(req));
  26. res.render('y.html', {
  27. locals: {
  28. content: "#content",
  29. after: function(aY, options, partial) {
  30. //aY is a reference to the document in the request
  31. //Y is the global Y instance you created above.
  32. Y.log('res.render after');
  33. Y.log(Y.dump(res));
  34. }
  35. }
  36. });
  37. });
  38. });
  39.  
  40. app.listen('3000');
Add Comment
Please, Sign In to add comment