Skip to content

Latest commit

 

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MoonBack

CI License

MoonBack is an asynchronous web backend framework for MoonBit. It provides routing, middleware, typed request and response helpers, WebSocket upgrades, graceful shutdown, and module-scoped dependency injection.

MoonBack is a pre-1.0 project. The core APIs are usable, but compatibility may change between minor releases. Packages under middlewares/unstable_* are explicitly experimental.

Install

Add MoonBack to your moon.mod:

import {
  "moonbitlang/async@0.21.0",
  "moonbitlang/moonback@0.8.2",
}

preferred_target = "native"

Migrating from hackwaly/moonback

Starting with version 0.8.2, MoonBack is published as moonbitlang/moonback. Replace the old dependency in moon.mod:

import {
  "moonbitlang/moonback@0.8.2",
}

Application source code can continue to use the @moonback package alias. If you import an experimental middleware directly, update its full package path from hackwaly/moonback/middlewares/... to moonbitlang/moonback/middlewares/... as well.

Quick start

async fn main {
  let app = @moonback.App(ctx => {
    ctx.get("/", (_req, res) => res.send_text("Hello, MoonBack!"))
  })
  defer app.close()

  let server = @moonback.listen(port=3000)
  app.serve(server)
}

See the full guide for routing, requests, responses, WebSockets, middleware, dependency injection, configuration, and lifecycle management.

Repository layout

  • moonback/ contains the published moonbitlang/moonback module.
  • examples/ contains runnable examples for dependency injection, graceful shutdown, static files, and WebSockets.

Contributing and security

Contributions are welcome. Read CONTRIBUTING.md before opening a pull request. Please report security vulnerabilities according to SECURITY.md, not through a public issue.

License

Licensed under the Apache License 2.0.

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages