feat(new): multi-runtime starter (node/deno/bun) via --runtime, shared + overlay templates
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
1 parent
c63c121787
commit
e8cd20b7ec
20 files changed
+173
-16
No files matched your search
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>{{project_name}}</title>
|
||||
<style>
|
||||
body { font-family: system-ui; display: grid; place-items: center;
|
||||
min-height: 100vh; margin: 0; background: #0f1f13; color: #d7f5df; }
|
||||
.logo { font-size: 4rem; }
|
||||
.zen { margin-top: 1rem; opacity: .85; font-style: italic; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div class="logo">🍵 green-tea</div>
|
||||
<div class="zen" id="zen">connecting…</div>
|
||||
</div>
|
||||
<script>
|
||||
const es = new EventSource('/zen');
|
||||
es.onmessage = (e) => { document.getElementById('zen').textContent = JSON.parse(e.data).zen; };
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Module } from '@green-tea/core';
|
||||
import { HomeController } from './controllers/home.controller';
|
||||
|
||||
@Module({ mountpoint: '/', controllers: [HomeController] })
|
||||
export class AppModule {}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { Route, Get, Html, Sse } from '@green-tea/core';
|
||||
|
||||
const ZEN = [
|
||||
'Simplicity is the ultimate sophistication.',
|
||||
'The obstacle is the path.',
|
||||
'When you let go, you have two hands to work.',
|
||||
'Make it work, make it right, make it fast.',
|
||||
'Less, but better.',
|
||||
];
|
||||
|
||||
@Route('/')
|
||||
export class HomeController {
|
||||
@Get('/')
|
||||
@Html('public/index.html')
|
||||
home() {}
|
||||
|
||||
@Sse('/zen')
|
||||
zen() {
|
||||
return (async function* () {
|
||||
for (let i = 0; ; i++) {
|
||||
yield { zen: ZEN[i % ZEN.length] };
|
||||
await new Promise((r) => setTimeout(r, 30_000));
|
||||
}
|
||||
})();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user