NEW
Font size
WorksheetsNodejs: Express
Total questions: 11
Worksheet time: 6mins
Frameworks can help with ready-made solutions for common tasks and problems
True
False
Not sure
I don't know
To create an express app with the imported module named express, which of the following syntax is correct?
app = server()
app = http.createServer()
app = express()
app = web()
To listen for connections, what function would you use?
app.listen
app.serve
app.connect
app.start
app.get('/students, callback)
Which of the following statements is false?
The http method is GET
The url is '/students'
The callback function will contain req and res objects
None of the options
One of these is used to send a JSON object to the client
res.send()
res.json()
res.status()
res.render()
A client has made a request for a resource but that resource is not found in our server. Select the correct syntax?
res.status(301).send(data)
res.status(404).send(data)
res.status(500).send(data)
res.status(201).send(data)
What method do we use to apply a middleware in express
app.use(middleware)
app.apply(middleware)
app.config(middleware)
app.render(middleware)
______ allow you to generate HTML dynamically based on data from your application.
Template Engines
Routers
Middlewares
Controllers
(req, res, next) => {} .... This function serves as _______
Controller
Middleware
Helper
Template Engine
Which component ends the request cycle provided all business logic are met?
Middleware
Controller
Request Hanlder
None of the options
app.get('/students/:id', (req, res) = { }). How do I get the value of id?
req.params.id
req.query.id
req.path.id
req.id
