8000 Rename buildRoutes -> registerRoutes · coder/coder@c17fc15 · GitHub
[go: up one dir, main page]

Skip to content

Commit c17fc15

Browse files
committed
Rename buildRoutes -> registerRoutes
1 parent c15b046 commit c17fc15

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

nextrouter/nextrouter.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func Handler(fileSystem fs.FS, options *Options) http.Handler {
4343
router := chi.NewRouter()
4444

4545
// Build up a router that matches NextJS routing rules, for HTML files
46-
buildRouter(router, fileSystem, *options)
46+
registerRoutes(router, fileSystem, *options)
4747

4848
// Fallback to static file server for non-HTML files
4949
// Non-HTML files don't have special routing rules, so we can just leverage
@@ -57,9 +57,9 @@ func Handler(fileSystem fs.FS, options *Options) http.Handler {
5757
return router
5858
}
5959

60-
// buildRouter recursively traverses the file-system, building routes
60+
// registerRoutes recursively traverses the file-system, building routes
6161
// as appropriate for respecting NextJS dynamic rules.
62-
func buildRouter(rtr chi.Router, fileSystem fs.FS, options Options) {
62+
func registerRoutes(rtr chi.Router, fileSystem fs.FS, options Options) {
6363
files, err := fs.ReadDir(fileSystem, ".")
6464
if err != nil {
6565
options.Logger.Warn(context.Background(), "Provided filesystem is empty; unable to build routes")
@@ -92,9 +92,9 @@ func buildRouter(rtr chi.Router, fileSystem fs.FS, options Options) {
9292
routeName = "{dynamic}"
9393
}
9494

95-
options.Logger.Debug(context.Background(), "Adding route", slog.F("name", name), slog.F("routeName", routeName))
95+
options.Logger.Debug(context.Background(), "Registering route", slog.F("name", name), slog.F("routeName", routeName))
9696
rtr.Route("/"+routeName, func(r chi.Router) {
97-
buildRouter(r, sub, options)
97+
registerRoutes(r, sub, options)
9898
})
9999
}
100100
}

0 commit comments

Comments
 (0)
0