Question
CS 602 Server Side development hw3 please explain and comment the following node.js code var express = require('express'); var bodyParser = require('body-parser'); var handlebars =
CS 602 Server Side development hw3 please explain and comment the following node.js code
var express = require('express'); var bodyParser = require('body-parser'); var handlebars = require('express-handlebars');
var app = express();
// setup handlebars view engine app.engine('handlebars', handlebars({defaultLayout: 'main_logo'})); app.set('view engine', 'handlebars');
// static resources app.use(express.static(__dirname + '/public'));
app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false }));
// Routing var routes = require('./partb_routes/index'); app.use('/', routes);
app.use(function(req, res) { res.status(404); res.render('404'); });
app.listen(3000, function(){ console.log('http://localhost:3000'); });
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started