Created
July 9, 2011 05:10
-
-
Save tj/1073340 to your computer and use it in GitHub Desktop.
luna -> js, just for fun since it's trivial to output js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| express = require('express') | |
| app = express createServer() | |
| app get('/'): req res next | |
| return res send('<p>Hello</p>') if req accepts('html') | |
| return res send('Hello') if req accepts('text') | |
| next() | |
| app listen(3000) | |
| console log('Express app started on port 3000') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'); | |
| var app = express.createServer(); | |
| app.get('/', function(req, res, next){ | |
| if (req.accepts('html')) return res.send('<p>Hello</p>'); | |
| if (req.accepts('text')) return res.send('Hello'); | |
| return next(); | |
| }); | |
| app.listen(3000); | |
| return console.log('Express app started on port 3000'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment