JSPM

rescript-types-hono

0.1.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 5
    • Score
      100M100P100Q27668F
    • License MIT

    This package contains rescript type definitions for hono.

    Package Exports

      This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rescript-types-hono) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

      Readme

      Hono

      Installation

      npm install --save rescript-types-hono

      Summary

      This package contains rescript type definitions for hono.

      Example

      let app = Hono.make()
      
      let expiresIn = () => Math.floor(Date.now() /. 1000.0) +. 60.0 *. 5.0
      
      let secret = "secret"
      
      app->Hono.use("/auth/*", HonoJwt.jwt({secret, cookie: "auth"}))
      app->Hono.getAsync("/", async c => {
        let authCookieContents = await HonoJwt.sign({sub: "", role: "", exp: expiresIn()}, secret)
        HonoCookie.setCookie2(
          c,
          "auth",
          authCookieContents,
          {
            path: "/",
            secure: false,
            domain: "localhost",
            httpOnly: true,
            expires: Date.fromTime(expiresIn() *. 1000.0),
            sameSite: "Strict",
          },
        )
        c.text("hi")
      })
      
      app->Hono.get("/auth/", c => {
        c.text("hi user")
      })
      import { serve } from '@hono/node-server'
      //@ts-ignore
      import {app } from "./App.res.js"
      
      serve({
        fetch: app.fetch,
        port: 8787
      }, (info) => {
        console.log(`Server is running on http://localhost:${info.port}`)
      })

      Details

      Files were exported from https://codeberg.org/lil5/rescript-reasonably-typed/src/branch/main/types/hono.