Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions