Use url.pathname to route different paths to different responses. Create a simple router that returns "Home" for /, "About" for /about, and "API" for /api.
Perfect! You can also use a switch statement or a routing library for more complex routing. For now, simple conditionals work great for most cases.
Use url.pathname to route different paths to different responses. Create a simple router that returns "Home" for /, "About" for /about, and "API" for /api.
Perfect! You can also use a switch statement or a routing library for more complex routing. For now, simple conditionals work great for most cases.