import { action, defineApp, page, state } from 'redweb'; @page('/', { css: 'app.css', shared: true }) export class CounterPage { @state() count = 0; @action() increment() { this.count += 1; } render() { return (

A counter owned by the server

Open this page in two tabs. Either button updates both.

); } } export const app = defineApp({ pages: [CounterPage], port: Number(process.env.PORT ?? 8181), templateRoot: __dirname }); if (require.main === module) void app.run().catch(error => { console.error(error); process.exitCode = 1; });