PARSE DATA
URl Parameters

Parsing URL Parameters

URL parameters embedded in the route path are parsed and converted automatically.

Example

Request:

fetch("/params/42/example")

Server-side:

import v from "vkrun"
 
const vkrun = v.App()
 
vkrun.get("/params/:id/:name", (request: v.Request, response: v.Response) => {
  console.log(request.params)
  // Output: { id: 42, name: "example" }
  response.status(200).end()
})

In this example:

  • "42" is converted to a number.
  • "example" remains a string.
Last updated on
Copyright © 2024 - 2025 MIT by Mario Elvio