x/alosaur/docs/README.md

Alosaur - Deno web framework with many decorators
Latest
File

Documentations

Application examples

Simple example:

import { App, Area, Controller, Get } from "https://deno.land/x/alosaur/mod.ts";

@Controller("/home")
export class HomeController {
  @Get("/text")
  text() {
    return "Hello world";
  }
  @Get("/json")
  json() {
    return { "text": "test" };
  }
}

@Area({
  controllers: [HomeController],
})
export class HomeArea {
}
const app = new App({
  areas: [HomeArea],
});

app.listen();
import { Cookie, setCookie, getCookies, delCookie } from "https://deno.land/std/http/cookie.ts";

  ...
  @Get('/view')
  view(Req() request: ServerRequest, @Res() response: Response) {
    const cookies = getCookies(request);
    
    const cookie: Cookie = { name: "Space", value: "Cat" };
    setCookie(response, cookie);

    delCookie(response, "deno");

    return View(result);
  }