Routing
Routing is the process of directing an item, request, or task to a destination or processing path according to relevant rules or characteristics.
Rust Servers, Services, and Apps
A router is a request-dispatching component that selects a handler based on the characteristics of an incoming request.
- How it is used
- Dispatches incoming HTTP requests to handlers in both a hand-built server and Actix Web applications.
- How deep it goes
- Defines the dispatch responsibility and works through route registration, scopes, path parameters, and checks with placeholder handlers.
- Examples
- Uses a GET health check, scoped course endpoints, and curl requests against POST, PUT, and DELETE placeholders.
- What you can do after
- Apply it via Actix Web route configuration and verify that requests reach the intended handlers with curl.
Read how Rust Servers, Services, and Apps explains routing →
ASP.NET Core in Action, 3e
Routing is the mechanism that maps incoming requests to application endpoints or handlers.
- How it is used
- Maps HTTP requests to endpoints across minimal APIs, Razor Pages, and MVC.
- How deep it goes
- Explains endpoint-selection middleware, route-template features, routing styles, and URL generation, with working examples.
- Examples
- Uses a person-search minimal API, file-based Razor Page routes, and a default MVC controller route.
- What you can do after
- Apply routing in ASP.NET Core to define endpoint mappings, capture URL values, and generate links.
Learn Go with Pocket-Sized Projects
A multiplexer is a web-serving component or library that matches incoming requests to handlers and manages their routing.
- How it is used
- Routes requests to handlers for a game API and an HTML-serving application.
- How deep it goes
- Works through mux creation, method-and-path registration, handler signatures, response status, and request checks.
- Examples
- Uses POST /games, curl checks for GET and POST, and a GET / index handler.
- What you can do after
- Apply routing via Go's net/http ServeMux to register handlers and serve requests.
Read how Learn Go with Pocket-Sized Projects explains routing →
Go in Practice, Second Edition
URL pattern matching is the routing of requests by applying expressive patterns to URL paths rather than only comparing fixed path segments.
- How it is used
- Maps HTTP requests to response handlers using paths, methods, and, where needed, path variables.
- How deep it goes
- Works through handler registration, method patterns, path extraction, nested multiplexers, and a custom regex alternative without requiring a framework.
- Examples
- Uses GET and POST comment handlers, an individual-comment path variable, and nested user and comment routers.
- What you can do after
- Build it from scratch with net/http handler patterns and PathValue, or extend routing with nested multiplexers.
Pro ASP.NET Core 7, Tenth Edition
Router is a Blazor component that discovers routable components in an assembly and renders the component matching the current URL.
- How it is used
- Selects Razor components as the URL changes, allowing multiple components to appear through a single request.
- How deep it goes
- Works through assembly configuration, Found and NotFound fragments, and the RouteView handoff; stops short of route-matching internals.
- Examples
- Configures Routed.razor with the current assembly, a RouteView for matches, and a visible unmatched-route message.
- What you can do after
- Build it from scratch with Router, RouteView, AppAssembly, Found, NotFound, and @page to select components by URL.
Read how Pro ASP.NET Core 7, Tenth Edition explains routing →
Build a DeepSeek Model (From Scratch)
A router is a small learnable neural network that assigns scores to experts for each input token in a mixture-of-experts model.
- How it is used
- Enables sparse expert activation per token in a mixture-of-experts layer.
- How deep it goes
- Develops routing from matrix dimensions through top-k dispatch and dynamic load-balancing updates in a complete MoE implementation.
- Examples
- Uses four 8-dimensional token embeddings and three experts to illustrate router score dimensions and two-of-three selection.
- What you can do after
- Builds routing from scratch in PyTorch, including expert dispatch and dynamic bias updates.
Read how Build a DeepSeek Model (From Scratch) explains routing →
Vanilla Web
Comparing a navigation destination with route definitions to select a view or handler.
- How it is used
- Maps navigation destinations to views while coordinating browser history, server responses, and same-document updates.
- How deep it goes
- Works through route patterns, interception, fallbacks, rendering responsibilities, and accessibility rather than stopping at path matching.
- Examples
- Uses product paths with named parameters, URL-backed account tabs, and a route table that lazy-loads page components.
- What you can do after
- Build it from scratch using real links, matched routes, browser navigation APIs, fallbacks, and accessible view updates.
Pro Angular 16
Router is the Angular service that performs programmatic navigation among application routes.
- How it is used
- Uses browser URLs to select displayed components and Router to initiate navigation from component or directive code.
- How deep it goes
- Works through route setup, template and code navigation, matching behavior, and troubleshooting; extends to child and dynamically loaded routes.
- Examples
- Uses store-to-cart navigation and a product form that returns to a table after submission.
- What you can do after
- Apply it via Angular Router to navigate after component actions and via routerLink for template-driven navigation.
Build an Advanced RAG Application (From Scratch)
A query router is a system component that determines which retrieval backend or knowledge source should handle a user query.
- How it is used
- Directs each RAG query to an internal collection or live web search before retrieval.
- How deep it goes
- Builds a three-route LLM classifier through prompt schema, collection dispatch, retrieval, and orchestration.
- Examples
- Demonstrates OpenAI file search, Uber financials, current LLM popularity, and other representative route decisions.
- What you can do after
- Build it from scratch as an LLM-routed RAG dispatcher for partitioned Qdrant collections and web search.
Read how Build an Advanced RAG Application (From Scratch) explains routing →
AI Agents and Applications
A router function is a callable that examines workflow conditions and returns the name of the next execution path.
- How it is used
- Directs workflow requests to a suitable retriever or specialist agent based on state or question intent.
- How deep it goes
- Works through route definitions, structured classification, dispatch, and tests, with guardrail and fallback guidance.
- Examples
- Uses tourist-information and accommodation queries to choose between retrievers or specialist agents.
- What you can do after
- Apply routing via LangChain and LangGraph to select retrieval chains or hand requests to specialist agents.
AI Agents in Action, Second Edition
Model routing is selecting and dispatching a request to a model or agent based on the request's characteristics and required task complexity.
- How it is used
- Directs requests to specialized agents or models and supports branched retrieval workflows.
- How deep it goes
- Explains classification, handoff, suitability, and quality–cost trade-offs without implementing a router.
- Examples
- Illustrates routing technical and billing questions to specialist agents and places a triage router before retrieval and answering.
- What you can do after
- Evaluate routing for a task load, including misclassification risk, mixed-domain requests, and model cost.
Read how AI Agents in Action, Second Edition explains routing →
Acing the Frontend Interview
Routing maps application locations or URLs to the interface content and behavior displayed for them.
- How it is used
- Connects application URLs with views, navigation flows, rendering strategies, and scalable React application architecture.
- How deep it goes
- Explains basic, nested, protected, and parameterized routes, then points toward lazy loading and prefetching without implementing advanced optimization.
- Examples
- Uses home, about, contact, nested user, dynamic profile, new-user, protected, login, and unmatched-route examples.
- What you can do after
- Apply routing via React Router and evaluate CSR, SSR, SSG, and mega-framework choices for scalable applications.
Retrieval Augmented Generation, The Foundational Ideas
A query router is a system component that analyzes a query and directs it to an appropriate retrieval or processing path.
- How it is used
- Directs incoming queries or atomic sub-queries to processing paths and retrievers suited to their needs.
- How deep it goes
- Explains pipeline, retriever, and dual-path decisions, then shows dispatch and bounded verification in a Python implementation.
- Examples
- Uses a supplier-recall question, complexity-based pipeline choices, and a Python LevelRAG engine.
- What you can do after
- Build it from scratch with per-sub-query searcher dispatch and a bounded verify-and-supplement loop.
Read how Retrieval Augmented Generation, The Foundational Ideas explains routing →
React in Depth
A route is a configured application endpoint or location that maps incoming requests to a handler or interface output.
- How it is used
- Maps URLs to React pages, route-specific data, and API responses in website frameworks.
- How deep it goes
- Works through fixed and parameterized file conventions, server-side data handoffs, and API handlers; does not detail routing internals.
- Examples
- Uses country and city URLs, shop-category data routes, and a coordinate-to-city geocoding API.
- What you can do after
- Apply it via Next.js pages routing or Remix to create dynamic pages with server-loaded data and API endpoints.
Google Anthos in Action
Traffic routing is the directed selection of destinations for network requests according to routing rules or release-management criteria.
- How it is used
- Supports controlled microservice releases, version selection, A/B testing, and progressive delivery.
- How deep it goes
- Explains percentage- and rule-based routing with release examples, but defers detailed routing configuration syntax.
- Examples
- Uses Istio canary traffic splitting, user-agent selection, and Knative 95/5 revision routing.
- What you can do after
- Apply it via Istio or Knative to shift traffic gradually between service revisions without application-code changes.
Designing AI Systems
Routing is the selection of a model provider for a request according to a configured strategy and runtime conditions.
- How it is used
- Selects providers before execution when applications delegate the choice to the Model Service.
- How deep it goes
- Explains configuration, shared routing state, and strategy choices, with a worked cost-aware decision flow.
- Examples
- Illustrates routing with a healthcare application allocating a $5,000 monthly budget across routine questions, complex reasoning, and local models.
- What you can do after
- Configure routing strategies and a default provider, or bypass routing by specifying a provider explicitly.
Build a Frontend Web Framework (From Scratch)
A client-side application component that maps URLs to views or components and manages navigation without a full page reload.
- How it is used
- Coordinates URL changes, component selection, and view updates in single-page applications.
- How deep it goes
- Traces SPA loading, mounting, navigation, and SSR route rendering, but stops short of implementing a complete router.
- Examples
- Uses SPA route navigation, dynamic mounting, SSR-rendered pages, and hydration as concrete examples.
- What you can do after
- Evaluate how SPA and SSR applications respond when users navigate between routes.
Read how Build a Frontend Web Framework (From Scratch) explains routing →
Coding with AI
A route is a web-application mapping between a URL pattern and the code that handles requests for that pattern.
- How it is used
- Uses URL patterns to direct web requests through quiz display, answer submission, and results.
- How deep it goes
- Works through Flask route handlers and quiz request flow, without developing routing internals.
- Examples
- Uses a root page that renders database questions and a quiz that stores answers before advancing.
- What you can do after
- Apply Flask routing to connect quiz URLs with question display, answer submission, and results.
Building Reliable AI Systems
The technique of directing different queries or tasks to selected models according to their requirements or cost.
- How it is used
- Matches query complexity to model capability to control cost and latency while reserving stronger models for demanding requests.
- How deep it goes
- Illustrates rule-based and model-based classification, with separate tests for ambiguous agent-routing decisions.
- Examples
- Uses store-hour and shipping questions, specialized legal or tax queries, and ambiguous shopping-assistant requests.
- What you can do after
- Apply it via a Python router that classifies queries with keywords and length before selecting a model.
Optimization Algorithms: AI techniques for design, planning, and control problems
A problem of finding a route between specified origins and destinations, often according to a distance, time, or cost criterion.
- How it is used
- Finds routes between locations by optimizing a road-network weight such as distance, travel time, fuel use, or turns.
- How deep it goes
- Works from road-network representation through search-method comparisons to a delivery-route optimization example.
- Examples
- Uses a Toronto statue-to-campus trip and an 18-store Walmart truck tour as routing examples.
- What you can do after
- Apply graph-search methods to road-network pathfinding and simulated annealing to a multi-stop delivery tour.
Learn Docker in a Month of Lunches, Second Edition
A Traefik router is a routing rule that matches an incoming request and selects a target service.
- How it is used
- Routes external HTTP traffic from container entrypoints to application services through hostname and path rules.
- How deep it goes
- Explains the router-to-service mapping and label configuration, then verifies it with dashboard inspection and curl.
- Examples
- Uses the whoami application, hostname labels, a Traefik dashboard, curl checks, and scaled containers.
- What you can do after
- Apply it via Docker Compose and Traefik labels, then verify hostname routing and upstream responses with curl.
Read how Learn Docker in a Month of Lunches, Second Edition explains routing →
Vibe Engineering
Model routing is the selective assignment of requests to different AI models according to task requirements such as complexity, quality, and cost.
- How it is used
- Routes requests by task requirements to balance model quality, cost, and latency.
- How deep it goes
- Measures task-level acceptance and CI savings, then flags routing false negatives; it does not claim two-pass review catches every issue.
- Examples
- Compares model tiers across coding tasks and uses a two-pass CI review with sampled checks for missed issues.
- What you can do after
- Configure model choices per workflow and sample filtered requests to check for routing misses.
The Well-Grounded Python Developer: How the pros use Python and Flask
A URL route is a web-framework mapping from a URL pattern or path to application code that handles requests for it.
- How it is used
- Connects browser-accessible URL paths to Python functions that process HTTP requests and produce responses.
- How deep it goes
- Defines decorator-based registration, request handling, and additional routes, while deferring broader application routing details.
- Examples
- Uses a Flask root route returning Hello World and a template-backed route rendering the current time.
- What you can do after
- Build it from scratch by registering Flask routes, serving responses, adding endpoints, and passing dynamic data to templates.
Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains routing →
Build an AI Agent (From Scratch)
A router agent is an AI agent that examines a request and transfers control to an appropriate specialist agent.
- How it is used
- Directs requests to suitable handlers or specialists when a fixed execution sequence is insufficient.
- How deep it goes
- Details agent-tree relationships, transfer state, target selection, and validation alongside the end-to-end handoff flow.
- Examples
- Uses billing and technical-support workflows, plus math and search specialists, to illustrate routing choices.
- What you can do after
- Operate and configure an agent tree with specialist descriptions, transfer targets, and optional peer transfers.
Read how Build an AI Agent (From Scratch) explains routing →
.NET in Action, Second Edition
A route is a URL pattern that an HTTP request can match to select an endpoint handler.
- How it is used
- Maps HTTP requests to response-producing handlers in a web service.
- How deep it goes
- Explains root and parameterized routes, including name matching, type conversion, and request failure when binding does not match.
- Examples
- Uses `/` for a greeting and `/{text}` to render URL text as ASCII art, with an optional font query parameter.
- What you can do after
- Apply routing through ASP.NET Core `MapGet` to return a greeting or render a path parameter as ASCII art.
Transformers in Action
A gating network is a lightweight neural component that scores experts and selects or weights them for each input token.
- How it is used
- Deploys inside transformer feed-forward positions to allocate computation selectively across mixture-of-experts networks.
- How deep it goes
- Explains scoring, top-k selection, softmax weighting, and GShard extensions, but does not detail the complete dispatch computation.
- Examples
- Demonstrates NativeGate top-k routing and GshardGate capacity-aware routing with optional random assignment.
- What you can do after
- Build it from scratch using a linear scorer, top-k selection, and softmax-normalized expert weights.
Build Financial Software with Generative AI (From Scratch)
APIRouter is FastAPI's routing component for grouping path operations and applying shared route configuration such as prefixes.
- How it is used
- Groups related API path operations and adds routers to a FastAPI application.
- How deep it goes
- Shows router creation, app inclusion, and prefix refactoring without exploring routing internals.
- Examples
- Uses file and audit endpoints, including an /api/v1/files prefix and a separate audit router.
- What you can do after
- Configure FastAPI routers, mount them in an application, and update tests when prefixed paths change.
Read how Build Financial Software with Generative AI (From Scratch) explains routing →
Learn Haskell by Example
A route is a URL path pattern that identifies an API operation and may contain variable segments.
- How it is used
- Defines Servant API operations by combining paths, HTTP methods, request bodies, captures, and response types.
- How deep it goes
- Encodes multiple typed endpoints and variable segments, but defers detailed explanation of DataKinds and TypeOperators.
- Examples
- Uses simple GET endpoints, JSON responses, POST request bodies, captured identifiers, and a typed todo-list API.
- What you can do after
- Apply routing via Servant by declaring typed paths, composing endpoints, capturing variables, and specifying request and response formats.
Essential TypeScript 5, Third Edition
Router is the Angular service that performs programmatic navigation and manages application URL changes.
- How it is used
- Performs navigation and selects displayed components from the current URL in Angular and React applications.
- How deep it goes
- Shows programmatic and declarative navigation plus route mapping, but does not detail Angular route-configuration internals.
- Examples
- Uses product, order, and summary URLs, including /summary/5, plus Angular and React route configuration examples.
- What you can do after
- Apply Angular Router and routerLink or React Router to navigate between components and redirect default URLs.
Read how Essential TypeScript 5, Third Edition explains routing →
Machine Learning System Design
Routing between models is a pattern that selects among models according to the characteristics or difficulty of each input.
- How it is used
- Uses input difficulty to direct serving requests toward models with appropriate cost and capability.
- How deep it goes
- Distinguishes difficulty-based selection from a two-model latency variation without detailing routing implementation.
- Examples
- Illustrates a fast, imperfect model followed by a slower, more accurate model.
- What you can do after
- Evaluate routing tradeoffs by distinguishing compute savings from faster time to initial response.
Latency
Request routing is the strategy of forwarding incoming requests to the component responsible for processing them.
- How it is used
- Uses request routing to direct partitioned-system traffic toward components with fast access to the required data.
- How deep it goes
- Defines the strategy, explains locality and balancing, and demonstrates implementation, but defers the actual data-partitioning strategy.
- Examples
- Demonstrates node-ID ports, a Rust REST API, round-robin HTTP benchmarking, and one-node versus five-node latency measurements.
- What you can do after
- Apply it via a partition-aware HTTP client that targets configured nodes and measures latency across different node counts.
Machines that Think
Routing is the process of assigning each input token to selected experts in a mixture-of-experts architecture.
- How it is used
- Assigns input tokens to selected experts so MoE layers can specialize computation while limiting per-token activation.
- How deep it goes
- Explains token scoring, top-expert selection, weighting, learning signals, and balancing constraints, but gives no routing algorithm or equations.
- Examples
- Uses a family doctor referring patients to specialists as an analogy for learned routing and specialization.
- What you can do after
- Understand how token assignment shapes expert learning and affects computational workloads.
Rearchitecting LLMs
Routing is the process of directing requests to a selected model or service according to a system’s rules.
- How it is used
- Directs agent requests for typed JSON arguments toward a specialized self-hosted model, with an external API fallback.
- How deep it goes
- Frames a safe routing strategy around shadow validation but does not specify routing conditions or implementation steps.
- Examples
- Uses a four-line prompt for typed JSON arguments and shadow-tests a candidate model against live agent traffic.
- What you can do after
- Evaluate a self-hosted model replacement against cost, latency, and reliability while users continue receiving API responses.
Financial AI in Practice
Model routing is the process of directing requests to different models according to their characteristics or requirements.
- How it is used
- Reduces generative AI costs by matching requests to model tiers according to task complexity and quality needs.
- How deep it goes
- Defines tier selection by request simplicity, risk, and quality needs but leaves routing logic and implementation unspecified.
- Examples
- Contrasts routing simple, low-risk requests to cheaper models with reserving top-tier models for premium or complex tasks.
- What you can do after
- Apply it via a smart gateway that sends requests to model tiers based on task demands.
Also covered in
- Acing the CCNA Exam: Volume 1 Fundamentals and Protocols
- Django in Action
- Akka in Action, Second Edition
- Build and Orchestrator in Go (From Scratch)
- .NET MAUI in Action
- Agent Design PatternsIn early access (MEAP)
- Spring AI in Action
- ScyllaDB in Action
- Modern Angular
- Architecting an Apache Iceberg Lakehouse
- LLM Evaluation and Alignment, The Foundational IdeasIn early access (MEAP)
- Python Concurrency with asyncio
What to know first
- JSONJSON is a language-independent text-based data-interchange format that represents structured values using objects, arrays, strings, numbers, booleans, and null.
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- serverA server is a computer system or software process that provides data, resources, or services to other systems, typically by responding to requests.
- contractA contract is an agreed specification of the conditions, expectations, rights, or obligations that govern behavior or interactions between parties or software components.
Related concepts
- asp-action attributeused by · The asp-action attribute is a Razor tag helper attribute that identifies the action method for which a URL should be generated.
- connected routeincludes · A connected route is a route to a network directly attached to an interface with an IP address that is operationally up.
- default routeincludes · A default route is a routing-table entry used when no more specific route matches a destination.
- handlerused by · A handler is a software routine or component invoked to process an event, request, message, or other input.
- fallbackcontrasts with · A fallback is an alternative behavior, result, resource, or processing path selected when a preferred option fails, is unavailable, or is inadequate.
Questions about routing
What is routing?
Routing is the process of directing an item, request, or task to a destination or processing path according to relevant rules or characteristics.
Which Manning books explain routing?
Rust Servers, Services, and Apps, ASP.NET Core in Action, 3e, Learn Go with Pocket-Sized Projects, Go in Practice, Second Edition, Pro ASP.NET Core 7, Tenth Edition, Build a DeepSeek Model (From Scratch), Vanilla Web, Pro Angular 16 and 26 more.
What should I know before learning routing?
Manning books that teach routing usually introduce JSON, language model, server and contract first.
What is the difference between routing and fallback?
Routing is the process of directing an item, request, or task to a destination or processing path according to relevant rules or characteristics. A fallback is an alternative behavior, result, resource, or processing path selected when a preferred option fails, is unavailable, or is inadequate.
What kinds of routing are there?
Kinds of routing include connected route, default route and direct routing.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

































