Launching web-app
These page summarizes basic concepts of running a Mandarine-powered web application.
Main
import { ..., MandarineCore } from "https://deno.land/x/mandarinets/mod.ts";
...
new MandarineCore().MVC().run();Single entry-point file
service1.ts
import { Service } from "https://deno.land/x/mandarinets/mod.ts";
@Service()
export class MyService {
public piValue(): number {
return 3.14;
}
}controller1.ts
import { Controller, GET } from "https://deno.land/x/mandarinets/mod.ts";
import { MyService } from "./service1.ts";
@Controller()
export class MyController1 {
constructor(private readonly service: MyService) {}
@GET('/first-endpoint')
public httpHandler() {
return `Hello world from MyController1. <br> The value of PI is ${this.service.piValue()}`;
}
}Last updated