hands-on lab

Working With Express - Route and Query Parameters

Difficulty: Intermediate
Duration: Up to 45 minutes
Students: 53
Rating: 5/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

In this lab, you will learn how to create routes that will accept route and query parameters inside an Express application. The route parameter,  which is sometimes referred to as the path parameter, is a named segment of the route and is used to access a specific resource of data. A query parameter, also known as a query string, is a set of parameters attached to the URL. The query parameter is often used to request data based on given criteria. The lab scenario is a clothing company that is creating a custom CRM for its customers. You are building the routes for this express application. The data structure for this application is located in the customerdata.js file that is inside the data folder. You can use this as a reference to understand how the routes are created to access specific data resources. If this is your first time working on the new express lab, make sure to watch the Introduction to Express Labs Video.

Learning Objectives

Upon completion of this beginner, you will be able to:

  • Understand how route parameters work in Express
  • Understand how query parameters work in Express
  • Be able to implement a GET route with a route parameter as part of the path
  • Be able to implement a GET route to capture a query parameter

Intended Audience

  • Software Engineers

Prerequisites

Completion of the following content is strongly recommended before attempting this lab:

Covered topics

Lab steps

Creating a GET Route With a Route Parameter for the User ID
Creating a GET Route With That Accepts a Query Parameter for User Shirt Size
Creating a GET Route With a Route Parameter for User State
Creating a Get Route With That Accepts a Query Parameter for User Postal Code