import { action, defineApp, page, state } from 'redweb';

@page('/', { shared: true })
class CounterPage {
    @state() count = 0;

    @action()
    increment() { this.count += 1; }

    render() {
        return <main>
            <h1>A counter owned by the server</h1>
            <button rw-click="increment">Count {this.count}</button>
        </main>;
    }
}

const app = defineApp({ pages: [CounterPage] });

await app.run();
