Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/code4craft/express.java

A tiny RESTful web framework with embed server. Used as instead of JMX for cross-language communication.
https://github.com/code4craft/express.java

Last synced: 4 days ago
JSON representation

A tiny RESTful web framework with embed server. Used as instead of JMX for cross-language communication.

Awesome Lists containing this project

README

        

express.java
=====
>A tiny RESTful web framework with embed server. Used as instead of JMX for cross-language communication.

## Features:

* ### Convention over Configuration

No xml and no annotation. Just write an application by API in Java.

```java
WebServer.jettyServer().get("/", new AjaxController() {
@Override
public Object ajax(ParamMap params) {
return ResultMap.create().put("code", 200).put("msg", "ok");
}
}).get("/echo", new AjaxController() {
@Override
public Object ajax(ParamMap params) {
return params;
}
}).get("/echo/${id}", new AjaxController() {
@Override
public Object ajax(ParamMap params) {
return ResultMap.create().put("id", params.getInt("id"));
}
}).port(8080).start();
```

* ### For Java8

```JAVA
public class RestAjax {

public static void main(String[] args) throws Exception {
WebServer.jettyServer().get("/", (params) -> {
return ResultMap.create().put("code", 200).put("msg", "ok");
}).get("/echo", (params) -> {
return params;
}).get("/echo/${id}", (params) -> {
return ResultMap.create().put("id", params.getInt("id"));
}).port(8080).start();
}
}
```

## License:

[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)