Skip to content

Commit

Permalink
fix(nitro): omit /index from generated api urls (#1371)
Browse files Browse the repository at this point in the history
  • Loading branch information
frbuceta authored Oct 22, 2021
1 parent 9132a67 commit f1a17f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/server/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ export interface ServerMiddleware {

function filesToMiddleware (files: string[], baseDir: string, basePath: string, overrides?: Partial<ServerMiddleware>): ServerMiddleware[] {
return files.map((file) => {
const route = joinURL(basePath, file.substr(0, file.length - extname(file).length))
const route = joinURL(
basePath,
file
.substr(0, file.length - extname(file).length)
.replace(/\/index$/, '')
)
const handle = resolve(baseDir, file)
return {
route,
Expand Down

0 comments on commit f1a17f2

Please sign in to comment.