Skip to content

Set up a CHO project ​

Choose the package that owns your entry point. You can add another package later when the application gains a second interface.

BuildInstallFirst working example
HTTP API@chojs/webServe a book as JSON
Command-line tool@chojs/commandPrint a shelf label
Message consumer@chojs/messageReceive an inventory message

Create a directory ​

sh
mkdir library
cd library

Install the package ​

The commands below set up the HTTP example. For a CLI or consumer, substitute the package from the table in the jsr add or deno add command.

sh
deno init
deno add jsr:@chojs/web
sh
npm init -y
npm pkg set type=module
npx jsr add @chojs/web
npm install --save-dev tsx typescript @types/node
sh
bun init -y
bunx jsr add @chojs/web

Each tutorial supplies its own app.ts and entry point. Use those contents for the named files, including any starter file generated by your runtime.

Check the environment ​

For the HTTP tutorial, use a runtime with the global URLPattern API. Check from the same runtime that will start the server.

sh
deno eval 'console.log(typeof URLPattern)'
sh
node -p 'typeof URLPattern'
sh
bun -e 'console.log(typeof URLPattern)'

A result of function means the built-in router is available. For another runtime, use the Hono adapter. CLI and in-memory message delivery work independently of the HTTP router.

Run your first application ​

Open the tutorial for the package you installed. Each has a complete entry point, an invocation and an expected result. The HTTP tutorial also explains how to test a request before opening a port. HTTP · Command line · Messages

Released under the MIT License.