Skip to main content
Module

x/fastro/examples/static.ts

Fast and simple web application framework for deno
Go to Latest
File
import { Fastro, Request } from "../mod.ts";
// setup static handler// you must set static: trueconst server = new Fastro({ static: true });server // static file with `/` url // `public` is your local static folder // Put all your static files in it. // // You can access a static file with url: // http://localhost:3000/index.html .static("/", "public") // static file with `/static` url // you can access a static file with url: // http://localhost:3000/static/index.html .static("/static", "public") .static("/oke", "public") .static("/oke/oke/oke/oke/oke", "public") .static("/1234/hi", "public");
// setup url end pointserver.get("/api", (req) => req.send("api"));
await server.listen({ port: 3000 });