@cowlang/cow
v0.0.9
Published
Cow, a web runtime for JavaScript and TypeScript pages, fresh on every request
Maintainers
Readme
Cow
Cow is a classic take on a web runtime for JavaScript and TypeScript. Cow allows you to write server-side JavaScript or TypeScript with HTML, with batteries included. If you like PHP, you'll love Cow.
Learn more about Cow in the documentation.
Installation
Cow supports multiple runtimes. For a quick install, use Node.js 22.16 or later.
Run without installing:
npx @cowlang/cow my-siteInstall cow globally:
npm install --global @cowlang/cowOr to add it to your project:
npm install --save-exact @cowlang/cowYour first page
Create a folder called my-site, and save this as my-site/index.cow:
<?js const name = req.get('name') || 'world' ?>
<h1>Hello, <?= h(name) ?>!</h1>Start Cow:
npx @cowlang/cow my-siteOpen http://127.0.0.1:8000/?name=Clover to see "Hello, Clover!" Edit the file and refresh to see your changes.
Learn more about writing pages in the docs.
Additional resources
- Getting started: installation, routing, deployment, and syntax checking.
- Request and response API: query strings, forms, uploads, redirects, and JSON.
- SQLite and sessions: queries, transactions, cookies, and sign-in.
- JavaScript runtimes: running on Bun, Deno, or Nub.
- Examples: a news site, a forum, file uploads, and a diagnostics page.
Cow hasn't reached 1.0 yet, so expect its APIs to change.
Contributing
To contribute, read the contributing instructions.
