Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/stdlib/http-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Built-in HTTP server with websocket support compiled to native code via libuv TC

## Router (recommended)

For most servers, use the `Router` class from `src/router.ts`. It provides an Express/Hono-style API with URL parameter extraction, method matching, and chainable response helpers.
For most servers, use the `Router` class from `chadscript/router`. It provides an Express/Hono-style API with URL parameter extraction, method matching, and chainable response helpers.

```typescript
import { Router, Context } from "./src/router";
import { Router, Context } from "chadscript/router";

const app = new Router();

Expand Down Expand Up @@ -86,10 +86,10 @@ app.get("/example", (c: Context) => {

### HTTP utility functions

`src/http-utils.ts` provides helpers for parsing common request data:
`chadscript/http-utils` provides helpers for parsing common request data:

```typescript
import { getHeader, parseQueryString, parseCookies } from "./src/http-utils";
import { getHeader, parseQueryString, parseCookies } from "chadscript/http-utils";

// Parse a single request header by name (case-insensitive)
const auth = getHeader(req.headers, "Authorization"); // "Bearer abc"
Expand Down
2 changes: 1 addition & 1 deletion examples/cli-parser-demo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// CLI Parser Demo - shows how to use ArgumentParser for professional CLI tools
import { ArgumentParser } from "../src/argparse.js";
import { ArgumentParser } from "chadscript/argparse";

const parser = new ArgumentParser("cli-parser-demo", "Example CLI tool with argument parsing");
parser.addFlag("verbose", "v", "Enable verbose output");
Expand Down
2 changes: 1 addition & 1 deletion examples/hackernews/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Hacker News Clone - full-stack app with SQLite, embedded files, and a JSON API
import { ArgumentParser } from "../../src/argparse.js";
import { ArgumentParser } from "chadscript/argparse";

const parser = new ArgumentParser(
"hackernews",
Expand Down
6 changes: 3 additions & 3 deletions examples/http-server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ArgumentParser } from "../src/argparse.js";
import { Router, Context } from "../src/router.js";
import { getHeader, parseQueryString } from "../src/http-utils.js";
import { ArgumentParser } from "chadscript/argparse";
import { Router, Context } from "chadscript/router";
import { getHeader, parseQueryString } from "chadscript/http-utils";

const parser = new ArgumentParser("http-server", "HTTP server with Router API");
parser.addOption("port", "p", "Port to listen on", "3000");
Expand Down
2 changes: 1 addition & 1 deletion examples/string-search.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// String Search - grep-like file search tool with colorized output
import { ArgumentParser } from "../src/argparse.js";
import { ArgumentParser } from "chadscript/argparse";

const parser = new ArgumentParser("string-search", "Search for a string pattern in files");
parser.addFlag("ignore-case", "i", "Case-insensitive search");
Expand Down
2 changes: 1 addition & 1 deletion examples/websocket/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// WebSocket Chat - real-time chat with embedded HTML/CSS served statically
import { ArgumentParser } from "../../src/argparse.js";
import { ArgumentParser } from "chadscript/argparse";

const parser = new ArgumentParser("websocket-chat", "Real-time WebSocket chat server");
parser.addOption("port", "p", "Port to listen on (0 = auto)", "0");
Expand Down
2 changes: 1 addition & 1 deletion examples/word-count.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Word Count - count lines, words, and characters in files (like wc)
import { ArgumentParser } from "../src/argparse.js";
import { ArgumentParser } from "chadscript/argparse";

const parser = new ArgumentParser("word-count", "Count lines, words, and characters in a file");
parser.addFlag("lines", "l", "Only show line count");
Expand Down
Loading
Loading