Skip to Content
ovr

Get Started

Installation

Install the ovr package from npm using your preferred package manager.

bash
npm i ovr

Alternatively, you can setup ovr with a pre-configured template using Vite with domco:

bash
npx create-domco@latest --framework=ovr

JSX configuration

To utilize JSX, add the following options to your tsconfig.json to enable the JSX transform. TypeScript, Vite, or esbuild will pickup the option from this file.

json
{ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "ovr" } }

Or you can use a comment if you are using ovr in conjunction with another framework to specify the import source for a specific module where you are using ovr.

tsx
/** @jsx jsx */
/** @jsxImportSource ovr */

While the ovr package does not depend on React, it uses the same JSX transform as React. This transform is built into tsc and other build tools.

Compatibility

ovr uses entirely standard JavaScript APIs, so it can run anywhere.

The ovr App server can be used in any Fetch API compatible runtime via App.fetch. Here are a few ways to create a Fetch based HTTP server in various JavaScript runtimes.

For example, using srvx you can plug app.fetch into the serve options.

tsx
// src/index.tsx
import { App } from "ovr";
import { serve } from "srvx";

const app = new App();

app.use(() => <h1>Hello World</h1>);

serve({ fetch: (req) => app.fetch(req) });

Then can compile tsx into js with TypeScript, and run the server with Node.

bash
tsc && node dist/index.js