Skip to content

chi mux mount http.ServMux not working,got 404 #1009

@it512

Description

@it512
package main

import (
	"fmt"
	"net/http"

	"github.com/go-chi/chi/v5"
)

func main() {
	root := chi.NewMux()
	mux := http.NewServeMux()
	mux.HandleFunc("GET /world", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintln(w, "hello world")
	})
	root.Mount("/hello", mux)
	http.ListenAndServe(":10011", root)
}

got a 404

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions