Express.js REST API
- 41Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
41 questions
- 1The framework being used to build a REST API on top of Node.js in this crash course is called_____.
Hint
This is a popular web application framework for Node.js.
Answer
Express.js
- 2Before starting to build the Express.js application, it is expected that the user understands what a_____API is.
Hint
This type of API follows a set of architectural constraints for web services.
Answer
restful
- 3The first step in setting up the Express.js application is to create a_____where the application's files will reside.
Hint
This is a fundamental organizational unit in a file system.
Answer
directory
- 4The command_____
npm init -yis used to initialize a Node application, which creates afile in the project directory.Hint
This file manages project dependencies and scripts.
Answer
package.json
- 5To install the Express.js framework, the command `npm install_____` is executed.
Hint
This is the primary dependency for building the REST API.
Answer
express
- 6The main file where the Express server logic will typically reside is named `_____` by many developers.
Hint
This is a common convention for the entry point of a JavaScript application.
Answer
index.js
- 7To create an instance of an Express application, the_____
express()function is.Hint
This action creates the 'app' object that handles requests.
Answer
invoked
- 8The_____
app.listen()method is used to start the server andfor incoming requests on a specified port.Hint
This method binds the application to a network address.
Answer
listen
- 9When the server starts successfully, a common practice is to use_____
console.log()within theapp.listencallback to confirm that the application is listening on port.Hint
This is a frequently used default port for development servers.
Answer
3000
- 10To execute the Node.js application from the terminal, the command `node_____
is used, assumingindex.js` is the main file.Hint
This command directly runs a JavaScript file with Node.js.
Answer
index
- 11In Express, routes are defined using HTTP_____like
get,post,put,patch, anddelete.Hint
These indicate the type of action to be performed on a resource.
Answer
verbs
- 12For retrieving data, it is considered best practice to use the `_____` verb for defining a route.
Hint
This verb is idempotent and safe for fetching resources.
Answer
get
- 13The first parameter when defining an Express route handler is the_____of the route, such as
/todos.Hint
This specifies the URL endpoint that the route will handle.
Answer
path
- 14A route handler callback function typically takes two parameters: `_____
for the incoming request andres` for the outgoing response.Hint
These are shorthand for request and response objects.
Answer
req
- 15To send back JSON data in an Express route, the `res._____()
method is commonly used instead ofres.send()`.Hint
This method automatically sets the
Content-Typeheader toapplication/json.Answer
json
- 16To enable hot reloading for a Node application during development, the_____
nodemonpackage can be installedusingnpm install nodemon -g.Hint
This installation type makes the package available across all projects.
Answer
globally
- 17A_____
devscript can be added to the `file, utilizingnodemon index.js` to run the application with hot reload functionality.Hint
This file contains scripts that can be run with
npm run.Answer
package.json
- 18GET requests can be tested directly in the browser by navigating to the appropriate_____.
Hint
Browsers perform GET requests by default when you type an address.
Answer
URL
- 19Postman is a popular tool used to_____a client making various types of HTTP requests, including GET, POST, PUT, and DELETE.
Hint
This tool helps developers test API endpoints by acting like a browser or mobile app.
Answer
simulate
- 20To add data to the server, the `_____` HTTP verb is typically used for routes.
Hint
This verb is used to submit an entity to the specified resource, often causing a change in state or a side effect.
Answer
post
- 21When sending data with a POST request, the data is usually passed within the request_____.
Hint
This is where the actual payload of the request resides.
Answer
body
- 22To process JSON data sent in the request body, Express needs to be configured with a_____using
app.use(express.json()).Hint
This function processes requests before they reach the route handler.
Answer
middleware
- 23The_____
express.json()middleware allows the application tothe JSON data from the request body.Hint
This action converts the JSON string into a JavaScript object.
Answer
parse
- 24When creating a new to-do item, its_____
titleis typically destructured from `req.body.`.Hint
This specific property holds the name of the to-do item.
Answer
title
- 25To generate unique string IDs for records, the `_____` package can be installed.
Hint
This package helps create Universally Unique Identifiers.
Answer
uuid
- 26The_____
v4function from theuuidpackage is invoked to create a brand new randomfor a to-do item.Hint
This is the data type of the unique identifier generated.
Answer
string
- 27When fetching a specific to-do, the unique identifier (ID) is typically passed as a_____parameter in the route, e.g.,
/todos/:id.Hint
This part of the URL changes based on the specific resource being requested.
Answer
dynamic
- 28In Express, a dynamic route parameter like_____
:idcan be accessed from `req.`.Hint
This object contains route parameters (e.g., from
/users/:id).Answer
params
- 29To modify an existing resource, the `_____` HTTP verb is commonly used.
Hint
This verb is typically used for replacing a resource or updating its properties.
Answer
put
- 30For updating the_____
completedstatus of a to-do item, the `method can be used on thetodos` array to find the index of the specific element.Hint
This array method returns the index of the first element in the array that satisfies the provided testing function.
Answer
findIndex
- 31To remove a resource from the server, the `_____` HTTP verb is utilized.
Hint
This verb indicates that the specified resource should be removed.
Answer
delete
- 32When deleting a to-do, the `_____` array method can be used to create a new array containing all elements except the one to be deleted.
Hint
This method creates a new array with all elements that pass the test implemented by the provided function.
Answer
filter
- 33To organize routes and avoid having all route handlers in one file, they can be grouped into separate files within a `_____` directory.
Hint
This directory name suggests its purpose: storing definitions for application endpoints.
Answer
routes
- 34Instead of_____
app, inside a dedicated route file, anexpress.Router()instance is used to define.Hint
This module provides a way to create modular, mountable route handlers.
Answer
router
- 35After defining routes in a separate file using_____
router, the `object is used to export therouter` instance so it can be imported elsewhere.Hint
This is a Node.js specific object used for exporting values from a module.
Answer
module.exports
- 36In the main_____
index.jsfile,app.use()is used totherouterfrom the separate route file, often with a common base path.Hint
This action integrates the router into the main application's middleware stack.
Answer
mount
- 37A common path, such as_____
/todos, specified inapp.use()for a router, will beto every route defined within that router file.Hint
This path acts as a prefix for all routes in the mounted router.
Answer
prepended
- 38Middleware is a function that runs_____a request actually reaches the route handler.
Hint
It acts as an intermediary step in the request-response cycle.
Answer
before
- 39A common use case for middleware is adding_____, where it checks if a user is authorized to make a request.
Hint
This process verifies the identity of a user or client.
Answer
authentication
- 40Middleware functions take_____
req,res, and `` as parameters.Hint
This parameter is a function that, when called, passes control to the next middleware function.
Answer
next
- 41If a middleware determines that a user is not authenticated, it can send a `_____` HTTP status code, indicating a forbidden request.
Hint
This status code means the server understood the request but refuses to authorize it.
Answer
403

Ask anything
We've read this whole study set, so questions about it get the best answers.