fastro init
command will generate folders and files like this.
.
├── app.yaml
├── container.ts
├── deps.ts
├── Dockerfile
├── main.ts
├── middleware
│ └── support.ts
├── module
│ ├── hello.controller.ts
│ ├── hello.template.html
│ ├── react.page.tsx
│ └── react.template.html
├── public
│ ├── favicon.ico
│ └── index.html
└── readme.md
3 directories, 13 files
You can render html template and pass dynamic value on it.
hello.template.html
in services
folder
<html>
<head>
<title>{{greeting}} {{name}}</title>
</head>
<body>
{{greeting}} {{name}}
</body>
</html>
You can change hello
name with other.
Open hello.controller.ts
handler.
Uncomment request.view
and comment request.send
.
import type { Request } from "https://deno.land/x/fastro@v0.30.43/mod.ts";
export default (request: Request) => {
request.view("hello.template.html", { greeting: "Hello", name: "World" });
// request.send("hello");
};
Open url
http://localhost:3000/hello
Now you see the greeting and name on the browser.