Where the code lives
In Cow, the file is the route. Put
index.cow in your site directory to serve /. JavaScript and HTML can live together, with shared logic in imported modules.<?js
const name = 'herd'
?>
<h1>Hello, <?= h(name) ?>!</h1>Express registers routes in application code. This example sends HTML from a route handler. See the Express introduction for its setup instructions.
import express from 'express'
const app = express()
app.get('/', (req, res) => {
res.send('<h1>Hello, herd!</h1>')
})
app.listen(3000)Which fits your project?
Try Cow if you want file-based pages, HTML next to server code, and a server you start with
cow site. Cow includes helpers for forms, sessions, and SQLite.Choose Express when you want to define routes in code or your application depends on Express middleware. Cow does not run Express middleware as page handlers.
Cow is in early development. Check its package compatibility before choosing it for an existing application.