Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var app = express()
  2.  
  3. // respond with "Hello World!" on the homepage
  4. app.get('/', function (req, res) {
  5.   res.send('Hello World!');
  6. })
  7.  
  8. // accept POST request on the homepage
  9. app.post('/', function (req, res) {
  10.   res.send('Got a POST request');
  11. })
  12.  
  13. app.get('/hello', function (req, res) {
  14.     res.send('You asked for hello!');
  15. })
  16.  
  17.  
  18. var server = app.listen(8080, function () {
  19.  
  20.   var host = server.address().address
  21.   var port = server.address().port
  22.  
  23.   console.log('Example app listening at http://%s:%s', host, port)
  24.  
  25. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement