Deno
Install Deno
curl -fsSL https://deno.land/x/install/install.sh | sh
Create new project with Deno
Deno provides deno init
to initialize an empty Deno project.
Check basic web server
main.ts
import { serve } from "http/server.ts"
import { Server } from "websi"
import { GET } from "websi/route.ts"
import * as Response from "websi/response.ts"
const routes = [
GET('/', () => Response.OK('Hello, Websi!')),
]
const server = Server(routes)
serve(server.fetch)
deno.json
{
"imports": {
"http/": "https://deno.land/[email protected]/http/",
"websi": "https://deno.land/x/[email protected]/mod.ts",
"websi/": "https://deno.land/x/[email protected]/"
},
"tasks": {
"dev": "deno run --watch main.ts"
}
}
Start the server in development
deno task dev
Open localhost:8000