Skip to main content
Module

x/fastro/examples/register.ts

The Web Framework for Full Stack Apps
Go to Latest
File
import fastro, { Fastro } from "../mod.ts";
const f = new fastro();
const helloModule = (f: Fastro) => { return f.get("/", () => "Hello World");};
const userModule = (f: Fastro) => { const path = `/api/user`; return f.get(path, () => "Get user") .post(path, () => "Add user") .put(path, () => "Update user") .delete(path, () => "Delete user");};
const productModule = (f: Fastro) => { const path = `/api/product`; return f.get(path, () => "Get product") .post(path, () => "Add product") .put(path, () => "Update product") .delete(path, () => "Delete product");};
f.register(helloModule);f.register(userModule);f.register(productModule);
await f.serve();