MCPcopy Index your code
hub / github.com/sveltejs/kit / serve

Function serve

packages/adapter-node/src/handler.js:46–63  ·  view source on GitHub ↗

* @param {string} path * @param {boolean} client

(path, client = false)

Source from the content-addressed store, hash-verified

44 * @param {boolean} client
45 */
46function serve(path, client = false) {
47 return (
48 fs.existsSync(path) &&
49 sirv(path, {
50 etag: true,
51 gzip: true,
52 brotli: true,
53 setHeaders:
54 client &&
55 ((res, pathname) => {
56 // only apply to build directory, not e.g. version.json
57 if (pathname.startsWith(`/${manifest.appPath}/immutable/`) && res.statusCode === 200) {
58 res.setHeader('cache-control', 'public,max-age=31536000,immutable');
59 }
60 })
61 })
62 );
63}
64
65// required because the static file server ignores trailing slashes
66/** @returns {import('polka').Middleware} */

Callers 2

serve_prerenderedFunction · 0.85
handler.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected