express Routing Routing Hello World


Example

The main app file loads the routes file where routes are defined.

app.js

var express = require('express');
var app = express();

app.use('/', require('./routes'));

app.listen('3000');

routes.js

var router = require('express').Router();

router.get('/', function(req, res) {
    res.send('Hello World!');
});

module.exports = router;