Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/drash/tests/deps.ts>Drash.Request#pathParam

A microframework for Deno's HTTP server with zero third-party dependencies
Go to Latest
method Drash.Request.prototype.pathParam
import { Drash } from "https://deno.land/x/drash@v2.7.0/tests/deps.ts";
const { Request } = Drash;

Get a path parameter from the request based on the request's URL and the resource path it matched to.

Examples

Example 1

// Assume a path for your resource is "/users/:id/:city?", and the request
// is "/users/2/".
const id = this.paramParam("id") // Returns 2
const city = this.queryParam("city") // Returns undefined

Parameters

name: string
  • The parameter name in the resource path.

Returns

string | undefined

The value for the parameter if found, or undefined if not set.