Skip to content

Commit 57aa158

Browse files
committed
Add support for extension-less html files
1 parent 01f74aa commit 57aa158

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/fastify-static.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import { Config } from "./types"
88
// https://github.com/fastify/fastify-static#fastify-static
99
//
1010
export function registerServeStatic(server: FastifyInstance, config: Config) {
11-
server.setNotFoundHandler((req, res) => {
11+
server.setNotFoundHandler(async (req, res) => {
1212
res.sendFile("index.html", config.staticDir)
1313
})
1414
server.register(fastifyStatic, {
1515
root: path.resolve(config.staticDir),
16+
extensions: ["html", "htm"],
1617
})
1718
}

0 commit comments

Comments
 (0)