August 2024
Intermediate to advanced
186 pages
4h 3m
English
As we have seen, the hx-get, hx-post, hx-put, hx-patch, and hx-delete attributes send an HTTP request when the element they are on is triggered. The htmx.ajax function also sends an HTTP request, but only when it’s explicitly called in JavaScript code. It can be used to conditionally or repeatedly send HTTP requests based on something other than triggering of an HTML element.
The following code from the file src/server.ts implements an HTTP server that serves static files from the public directory. It also defines an endpoint that returns the amount of heap memory being used by the server, in megabytes.
| | import {heapStats} from 'bun:jsc'; |
| | import {type Context, Hono} from 'hono'; |
| | import ... |
Read now
Unlock full access