Mocket - Getting Started (0.5.8)
A web framework for MoonBit.
Quick Start
bash
moon add oboard/mocketmoonbit
let app = @mocket.new()
app.get("/", _ => Text("Hello, Mocket!"))
app.group("/api", group => {
group.get("/status", _ => Json({ "status": "ok" }))
})
app.serve(port=4000)Mocket supports both js and native backends.
JavaScript Backend
Set the backend of MoonBit to js in Visual Studio Code
Command: MoonBit: Select Backend -> js
bash
moon run src/example --target jsNative Backend
Set the backend of MoonBit to native in Visual Studio Code
Command: MoonBit: Select Backend -> native
bash
moon run src/example --target nativeThen visit http://localhost:4000