basic

command
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 4 Imported by: 0

README

Basic Router Example

This example demonstrates the basic usage of the Dracory HTTP Router package.

Features Demonstrated

  • Creating a new router
  • Adding routes with shortcut methods
  • Creating route groups
  • Nested route groups
  • Basic request handling
  • Exact path matching

Running the Example

  1. Make sure you have Go installed (1.16 or later)
  2. Navigate to this directory
  3. Run the example:
    go run main.go
    
  4. Open your browser or use curl to test the endpoints:
    • http://localhost:8080/hello
    • http://localhost:8080/api/status
    • http://localhost:8080/api/users
    • http://localhost:8080/api/users/123

Endpoints

  • GET /hello - Simple hello world endpoint
  • GET /api/status - API status check
  • GET /api/users - List users
  • GET /api/users/123 - Get specific user (exact match required)

Code Structure

The example shows:

  1. Router initialization
  2. Basic route definition
  3. Route grouping
  4. Nested routes
  5. Exact path matching

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL