An open API service indexing awesome lists of open source software.

https://github.com/herudi/hx-page

Effortless Htmx in Deno.
https://github.com/herudi/hx-page

deno denodeploy deploy htmx nextjs

Last synced: 4 months ago
JSON representation

Effortless Htmx in Deno.

Awesome Lists containing this project

README

        

# HX-Page

Effortless [Htmx](https://htmx.org) in [Deno](https://deno.com).

## Features

- NextJS Router like.
- Helmet Support.
- AsyncComponent support.
- Middleware support : `ETag`, `cache-control`, `twind` and more.
- Including Hooks : `useRequestEvent`, `useRouter`, `useBody` and more.

## Starter

```bash
deno run -Ar https://hxp.deno.dev my_app
```

```bash
cd my_app

// dev
deno task dev

// prod
deno task start
```

## Code Snippet

```tsx
// pages/todo.tsx

import { FC, Helmet, hx, useBody } from "hxp";

type Todo = { text: string };

const addTodo = hx.post(async () => {
const todo = useBody();

// example save todo to db.
await db.todo.save(todo);

return

  • {todo.text}
  • ;
    });

    const Todo: FC = async () => {
    // example load todos from db.
    const todos = await db.todo.findAll();

    return (
    <>

    Todo



    Submit


      {todos.map((todo) =>
    • {todo.text}
    • )}

    >
    );
    };

    export default Todo;
    ```

    ## Deploy

    ```bash
    // generate page first
    deno task pages

    // deploy
    deployctl deploy --prod --project=my_app main.ts
    ```

    more => https://hxp.deno.dev

    ## License

    [MIT](LICENSE)