Mandarine.TS
Latest
Latest
  • Mandarine.TS
  • Getting started
    • Installing Deno Runtime
    • Setting up Environment
    • Quick Example
  • Concepts
  • Mandarine Project Structure
  • Mandarine CLI
    • CLI Reference
      • mandarine new
      • mandarine generate
      • mandarine run
  • Mandarine Core
    • Core Initialization
    • Mandarine.json
    • Dot env file
    • Properties
      • The @Value Decorator
    • Components
      • Controller
      • Middleware
      • Repository
      • Component
      • Service
      • Configuration
      • Manual Component
    • Dependency Injection
      • Accessing DI container
    • Resource Handlers
      • Resource Handler Registry
      • Resource Handler
      • Resource Resolver
  • Mandarine MVC
    • Web MVC
    • Controllers
      • Routes
        • Parameterized Routes
      • HTTP Handlers
      • @ResponseStatus
    • Custom Middleware
    • Session Middleware
    • CORS Middleware
    • Template Engine
      • @Render Decorator
      • Accessing data from template
    • Launching web-app
    • Serving Static Content
    • Multipart Form Data
  • Mandarine Security
    • Sessions
  • Mandarine Data
    • ORM
      • Data source
      • Models
      • Repositories
        • Interacting with data
        • Updating data
    • Mandarine Query Language
  • Resources
    • Changelog
  • Plugins
    • Optional
    • Promise Repeater
Powered by GitBook
On this page
  • Concepts
  • Usage

Was this helpful?

  1. Mandarine MVC
  2. Controllers
  3. Routes

Parameterized Routes

Parameterized routes help you develop flexible endpoints as they can receive information from the user and transmit it to the back-end by only using the URL. They are a variable in a url.

Concepts

  • The variables in a parameterized route must start with :

  • We can have as many parameterized routes as we want as long as all our variables start with : and have different names

Usage

import { GET, MandarineMVC } from "https://deno.land/x/mandarinets/mod.ts";

@Controller()
export class MyController {
    
    @GET('/get-user/:id')
    public httpHandler(@RouteParam() id: number) {
        return `Hello, user with id ${id}`;
    }
    
}

new MandarineMVC().run();
PreviousRoutesNextHTTP Handlers

Last updated 4 years ago

Was this helpful?

Some concepts shown in the example above are discussed and explored in

HTTP Handlers