express.js official migration guide is not sufficient yet.
- Check manually in your RequestHandler
- Be careful declaration order
// users.router.ts
import { Router } from "express";| /** | |
| * date string | |
| */ | |
| const s = "20260430"; | |
| const d1 = Temporal.PlainDate.from(s); // 2026-04-30 | |
| const d2 = Temporal.Now.plainDateISO(); // 2026-05-01 | |
| // .isBefore() / .isAfter() | |
| Temporal.PlainDate.compare(d1, d2); // -1 | |
| Temporal.PlainDate.compare(d1, d1); // 0 |
| import { newWebSocketRpcSession } from "capnweb"; | |
| import type { MyApi } from "./server.ts"; | |
| const api = newWebSocketRpcSession<MyApi>("ws://localhost:8080/api"); | |
| const result = await api.hello("World"); | |
| console.log(result); |
| services: | |
| db: | |
| image: mysql:8.0 | |
| command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_0900_bin | |
| environment: | |
| - MYSQL_ALLOW_EMPTY_PASSWORD=yes | |
| - MYSQL_DATABASE=app_development | |
| ports: | |
| - "3306:3306" |
| import { Suspense, use } from 'react'; | |
| function Messages({ fetchMessages }: { fetchMessages: Promise<string[]> }) { | |
| // Promise must be initialized outside the component currently. | |
| // see: https://react.dev/blog/2024/12/05/react-19#new-feature-use | |
| // | |
| // This doesn't work; | |
| // ``` | |
| // const messages = use(new Promise<string[]>((resolve) => { | |
| // setTimeout(() => { |
| /** | |
| * @example | |
| * ```ts | |
| * const POST_STATE = { | |
| * DRAFT: 0, | |
| * PUBLISHED: 1, | |
| * // ... | |
| * } as const; | |
| * type PostState = (typeof POST_STATE)[keyof typeof POST_STATE]; | |
| * |
express.js official migration guide is not sufficient yet.
// users.router.ts
import { Router } from "express";| import { assertEquals } from "jsr:@std/assert"; | |
| import { paginate } from "./pagination.ts"; | |
| Deno.test(function paginateTest() { | |
| assertEquals(paginate(1, 1), [1]); | |
| assertEquals(paginate(1, 2), [1, 2]); | |
| assertEquals(paginate(2, 2), [1, 2]); |
| #!/bin/bash | |
| function print_multiline() { | |
| local text=$(cat <<'EOF' | |
| ``` | |
| # Markdown Text | |
| - one | |
| - two | |
| ``` |
| /** | |
| * ref: https://www.freecodecamp.org/news/javascript-range-create-an-array-of-numbers-with-the-from-method/ | |
| * | |
| * # Example | |
| * | |
| * ```ts | |
| * import { range } from "./main.ts"; | |
| * | |
| * range(1, 5); | |
| * // [1, 2, 3, 4, 5] |