puerto 0.19.0

Puerto — Rust full-stack DDD framework CLI. Scaffolds Clean Architecture projects with auto-wired DI, SQLx support, and zero manual wiring. Formerly puerto-framework.
// AUTO-GENERATED by puerto. Edit puerto.toml, then run `puerto generate bootstrap`.

import { Route, Switch } from "wouter";
{% for e in entities -%}
import { {{ e.pascal }}DetailContainer } from "../../features/{{ e.kebab }}/containers/{{ e.kebab }}-detail-container";
import { {{ e.pascal }}FormContainer } from "../../features/{{ e.kebab }}/containers/{{ e.kebab }}-form-container";
import { {{ e.pascal }}ListContainer } from "../../features/{{ e.kebab }}/containers/{{ e.kebab }}-list-container";
{% endfor -%}
{% if auth and not local -%}
import { AuthCallbackPage } from "../../pages/auth-callback";
{% endif -%}
import { HomePage } from "../../pages/home";
{% if local -%}
import { LoginPage } from "../../pages/login";
{% endif -%}
import { NotFoundPage } from "../../pages/not-found";
{% if local -%}
import { RegisterPage } from "../../pages/register";
{% endif -%}
import type { NavEntry } from "../../shared/ui/layout";
{% if guarded -%}
import { RequireAuth } from "../auth";
{% endif -%}
import { customRoutes } from "../routes";

export const navEntries: NavEntry[] = [
{%- if nav_inline %}
{%- for e in entities %}{ label: "{{ e.label_plural }}", href: "/{{ e.plural }}" }{% endfor -%}
{%- else %}
{%- for e in entities %}
  { label: "{{ e.label_plural }}", href: "/{{ e.plural }}" },
{%- endfor %}
{% endif %}];

export function AppRoutes() {
  return (
    <Switch>
      <Route path="/">
        <HomePage entries={navEntries} />
      </Route>
{%- if local %}
      <Route path="/login">
        <LoginPage />
      </Route>
      <Route path="/register">
        <RegisterPage />
      </Route>
{%- elif auth %}
      <Route path="/auth/callback">
        <AuthCallbackPage />
      </Route>
{%- endif %}
      {customRoutes}
{%- for e in entities %}
      <Route path="/{{ e.plural }}">
{%- if e.list_guarded %}
        <RequireAuth>
          <{{ e.pascal }}ListContainer />
        </RequireAuth>
{%- else %}
        <{{ e.pascal }}ListContainer />
{%- endif %}
      </Route>
      <Route path="/{{ e.plural }}/new">
{%- if e.new_guarded %}
        <RequireAuth>
          <{{ e.pascal }}FormContainer />
        </RequireAuth>
{%- else %}
        <{{ e.pascal }}FormContainer />
{%- endif %}
      </Route>
{%- if e.edit_guarded %}
      <Route path="/{{ e.plural }}/:id/edit">
        {(params) => (
          <RequireAuth>
            <{{ e.pascal }}FormContainer id={params.id} />
          </RequireAuth>
        )}
      </Route>
{%- elif e.edit_route_inline %}
      <Route path="/{{ e.plural }}/:id/edit">{(params) => <{{ e.pascal }}FormContainer id={params.id} />}</Route>
{%- else %}
      <Route path="/{{ e.plural }}/:id/edit">
        {(params) => <{{ e.pascal }}FormContainer id={params.id} />}
      </Route>
{%- endif %}
{%- if e.detail_guarded %}
      <Route path="/{{ e.plural }}/:id">
        {(params) => (
          <RequireAuth>
            <{{ e.pascal }}DetailContainer id={params.id} />
          </RequireAuth>
        )}
      </Route>
{%- elif e.detail_route_inline %}
      <Route path="/{{ e.plural }}/:id">{(params) => <{{ e.pascal }}DetailContainer id={params.id} />}</Route>
{%- else %}
      <Route path="/{{ e.plural }}/:id">
        {(params) => <{{ e.pascal }}DetailContainer id={params.id} />}
      </Route>
{%- endif %}
{%- endfor %}
      <Route>
        <NotFoundPage />
      </Route>
    </Switch>
  );
}