Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ts_serve/src/file_server.ts>serveFileWithTs

Transpile TypeScript on the fly and deliver it from your server as ES Modules.
Latest
function serveFileWithTs
import { serveFileWithTs } from "https://deno.land/x/ts_serve@v1.4.4/src/file_server.ts";

This can be used in the same way as the serveFile function of the standard library, but if the file is TypeScript, it will be rewritten to JavaScript.

import { serve } from "https://deno.land/std@0.177.0/http/mod.ts";
import { serveFileWithTs, fourceInstantiateWasm } from "https://deno.land/x/ts_serve@v1.4.4/mod.ts";

fourceInstantiateWasm();
serve((request) => serveFileWithTs(request, "./mod.ts"));

Parameters

request: Request
filePath: string
optional
options: ServeFileOptions