nx.js

Usage

Installation

npm install @nx.js/http
pnpm add @nx.js/http
yarn add @nx.js/http
bun add @nx.js/http

Example

src/main.ts
import { listen } from '@nx.js/http';

listen({
    // Listen on port 8080
    port: 8080,

    // Handle HTTP requests
    fetch(req) {
        console.log(`Got HTTP ${req.method} request for "${req.url}"`);
        return new Response('Hello World!');
    }
});

On this page