Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = express()
- // respond with "Hello World!" on the homepage
- app.get('/', function (req, res) {
- res.send('Hello World!');
- })
- // accept POST request on the homepage
- app.post('/', function (req, res) {
- res.send('Got a POST request');
- })
- app.get('/hello', function (req, res) {
- res.send('You asked for hello!');
- })
- var server = app.listen(8080, function () {
- var host = server.address().address
- var port = server.address().port
- console.log('Example app listening at http://%s:%s', host, port)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement