https://github.com/koooooo-7/kono
💊 A simplified lightweight restful web framework.
https://github.com/koooooo-7/kono
java kono spirngboot webframework
Last synced: about 1 year ago
JSON representation
💊 A simplified lightweight restful web framework.
- Host: GitHub
- URL: https://github.com/koooooo-7/kono
- Owner: Koooooo-7
- License: apache-2.0
- Created: 2020-07-19T15:33:11.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-11-19T15:48:13.000Z (over 3 years ago)
- Last Synced: 2025-04-01T01:51:08.554Z (over 1 year ago)
- Topics: java, kono, spirngboot, webframework
- Language: Java
- Homepage: https://github.com/Koooooo-7/Kono
- Size: 91.8 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Kono
💊 A simplified lightweight restful web framework.
*When I used lots of out-of-box stuff, I wanna create something by myself, it does not matter whether it is fellowing the trending right now. I just wanna integrate those classic features from different languages/frameworks in my mind to one place, thus `Kono` is here, which is a simplified lightweight web framework.*
### ✨ Features
- Automatically route
It will automatically generate the route based on the controller and methods.
- Dynamical request support
You can use one method to support both `GET` and `POST` requests.
- Flexible acquire parameters
There is more flexible way to acquire request parameters, and support parameter preprocessing.
- Streaming responses
Using the builder way to return your responses and build your own fully response.
### 📝 Usage
Let us have a look how it works easily. *(More details see the samples in project.)*
Create an `IndexController` supports the requests.
- GET /index/user
- POST /index/user
```java
// the default root route will be /index
public class IndexController extends BaseController {
// both support the GET and POST request to /index/user
public void user() {
// get the specific request parameter
Optional user = this.getRequest().get("user", (parameter) -> {
// you could do some thing before you get the parameter, such as set a filter;
return parameter;
});
Map map = new HashMap<>();
map.put("Koy", "Hello World!");
map.put(user.orElseGet(() -> "Anonymous"), "Kono!");
this.getResponse().send(map).json();
}
// only support the GET request to /index/user, the specific request type method has higher priority.
public void getUser(){
Optional user = this.getRequest().get("user");
Map map = new HashMap<>();
map.put("Koy2", "Hello World!2");
map.put(user.orElseGet(() -> "Anonymous2"), "Kono!2");
this.getResponse().send(map).json();
}
}
```
### 💡 Reference
Thanks to those projects which inspire me and give me references a lot. (and there will get more and more)
[SpringBoot](https://github.com/spring-projects/spring-boot) - A popular, wonderful and elegant web framework in Java.
[Laravel](https://github.com/laravel/laravel) - A PHP framework for web artisans.
[ThinkPHP](https://github.com/top-think/framework) - A easy to use PHP framework.
[Django](https://github.com/django/django) - The Web framework for perfectionists with deadlines in Python.
[JOOQ](https://github.com/jOOQ/jOOQ) - A fancy ORM lib to write SQL in Java.
### 📃 LICENSE
Apache-2.0 License [©Koy](https://github.com/Koooooo-7)