Dealing with routes

Now that we have completed the implementation of user authentication, we need to configure the application routes to handle the validation and creation of users.

Let's make some changes in the index.js file inside the routes folder:

  1. Add the following highlighted code to the index.js file:
    var express = require('express');
    var router = express.Router();
    var passport = require('passport');
    
    /* GET home page. */
    router.get('/', function(req, res) {
      res.render('index.ejs');
    });
    
    module.exports = router;

    Note that we set up the default router to render a page called index.ejs. We have not created this page yet, but we will do so soon; for now, we will continue setting the necessary routes to handle authentication.

  2. Let's create the route ...

Get Learning Single-page Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.