Skip to main content
Module

x/drash/src/http/request.ts>DrashRequest#pathParam

A microframework for Deno's HTTP server with zero third-party dependencies
Go to Latest
method DrashRequest.prototype.pathParam
import { DrashRequest } from "https://deno.land/x/drash@v2.7.0/src/http/request.ts";

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.