Skip to content

aoiroaoino/guttural

Repository files navigation

Monoton

Web Framework for Scala inspired by Play Framework.

Status: PoC

Setup

framework

$ sbt root/publishLocal
$ sbt plugin/publishLocal

project/plugins.sbt

addSbtPlugin("dev.aoiroaoino" % "monoton-plugin" % "0.1.0-SNAPSHOT")

build.sbt

lazy val root = (project in file("."))
  .enablePlugins(MonotonPlugin)

docs

$ sbt docs/makeMicrosite
$ cd docs/target/site
$ jekyll serve

Usage

Minimal App

$ sbt run
$ curl -i http://localhost:8080
HTTP/1.1 200 OK
content-type: text/html
content-length: 24
connection: close

<h1>Hello, Monoton!</h1>

Ping/Pong App

[root]/example/controllers/StatusController.scala:

package example.controllers

import monoton.http.Response
import monoton.server.Controller

class StatusController extends Controller {
  def ping: RequestHandler = HandlerBuilder.pure(Ok("pong"))
}

[root]/example/MyRouter.scala:

[root]/AppModule.scala:

import com.google.inject.AbstractModule
import monoton.server.Router

class AppModule extends AbstractModule {
  override def configure(): Unit = {
    bind(classOf[Router]).to(classOf[example.MyRouter])
  }
}
$ sbt run
$ curl -i http://localhost:8080/ping
HTTP/1.1 200 OK
content-type: text/plain
content-length: 4
connection: close

pong

Other Example

see: https://github.com/aoiroaoino/monoton-example

Releases

No releases published

Packages

No packages published