https://github.com/adamjosefus/allo_controllers
🦕 Simple "convention over configuration" Controllers solution for Deno.
https://github.com/adamjosefus/allo_controllers
controller deno framework mvc router typescript
Last synced: 10 months ago
JSON representation
🦕 Simple "convention over configuration" Controllers solution for Deno.
- Host: GitHub
- URL: https://github.com/adamjosefus/allo_controllers
- Owner: adamjosefus
- Created: 2022-02-15T19:47:17.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-04T15:42:56.000Z (almost 4 years ago)
- Last Synced: 2025-04-29T13:01:39.712Z (11 months ago)
- Topics: controller, deno, framework, mvc, router, typescript
- Language: TypeScript
- Homepage:
- Size: 99.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **Allo Controllers** for Deno 🦕
Simple "convention over configuration" Controllers solution for Deno.
Extends the [**Allo Routing**](https://deno.land/x/allo_routing/mod.ts) framework with a **Controllers** layer.
# Controller
```ts
// ./controllers/HomepageController.ts
import { Controller } from "../../libs/Controller.ts";
export class HomepageController extends Controller {
renderDefault() {
this.sendText("Hello World!");
}
}
```
```ts
// ./main.ts
import { Server } from "https://deno.land/x/allo_server/mod.ts";
import { ControllerManager, RouterList } from "https://deno.land/x/allo_controllers/mod.ts";
const manager = new ControllerManager("./controllers");
const router = new RouterList(manager);
router.addController("homepage/", "Homepage:default");
const server = new Server(router);
server.listen({ port: 8080 });
```
## Life Cycle
```mermaid
%% Looks weird? View on github.
flowchart TB
A("contructor()") --> B("inject*()")
B --> C("onStartup() && startup()")
C --> D("action<'Action'>()")
D --> E("beforeRender() && onRender()")
E --> F("render<'View'>()")
F --> G("afterRender()")
G --> H("onShutdown() && shutdown()")
```
---
## Documentation 📖
Description of all classes and methods with **examples**
will found in the [documentation](https://doc.deno.land/https://deno.land/x/allo_controllers/mod.ts).
---
Check out other [ours packages 📦](https://deno.land/x?query=allo_)!