Server-side runtime for the evjs fullstack framework.
- Hono-based — Build RESTful APIs alongside your React application.
- Server Function Support — Seamlessly handle
"use server"function calls with type safety. - Standard Request/Response —
createRoute()factory for simplified API endpoint creation. - Multi-Runtime — First-class support for Node.js and ECMA runtimes (Deno, Bun, Cloudflare Workers).
npm install @evjs/server honoCreate standard REST endpoints using the createRoute() factory:
// src/api/users.ts
import { createRoute } from "@evjs/server";
export const GET = createRoute("/api/users", {
GET: async (c) => Response.json([{ id: 1, name: "Alice" }]),
});The path must be a string literal string for compatibility with the framework's build system.
Use the "use server" directive in *.server.ts files:
// src/api/posts.server.ts
"use server";
export async function getPosts() {
// Query DB or third-party API
return [{ id: 1, title: "Hello World" }];
}import { serve } from "@evjs/server/node";
import { app } from "./app";
serve(app, { port: 3001 });import { createFetchHandler } from "@evjs/server/ecma";
import { app } from "./app";
Deno.serve({ port: 3001 }, createFetchHandler(app).fetch);createRoute(path, handler): Create a REST endpoint.createApp(options): Main application factory.
MIT