{"id":17689975,"url":"https://github.com/mikigal/yunoframework","last_synced_at":"2025-03-30T22:13:55.130Z","repository":{"id":102381439,"uuid":"361821421","full_name":"mikigal/YunoFramework","owner":"mikigal","description":"Simple web framework with built-in HTTP server","archived":false,"fork":false,"pushed_at":"2021-05-01T20:18:54.000Z","size":141,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T02:44:35.252Z","etag":null,"topics":["http","http-server","java","mvc","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikigal.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-26T16:36:44.000Z","updated_at":"2021-05-10T11:47:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"0a6189ac-fae4-4044-aa0e-8abcd63c81a7","html_url":"https://github.com/mikigal/YunoFramework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikigal%2FYunoFramework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikigal%2FYunoFramework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikigal%2FYunoFramework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikigal%2FYunoFramework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikigal","download_url":"https://codeload.github.com/mikigal/YunoFramework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246385415,"owners_count":20768672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","http-server","java","mvc","rest-api"],"created_at":"2024-10-24T11:49:31.554Z","updated_at":"2025-03-30T22:13:55.099Z","avatar_url":"https://github.com/mikigal.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YunoFramework\nSimple web framework with built-in HTTP server\n\n## Features\n  - Built-in NIO based HTTP server\n  - Easy to use API\n  - Routing\n  - Middleware\n\n## Example\n```java\npublic class TestApplication {\n\n    public static void main(String[] args) {\n        Yuno yuno = Yuno.builder()\n                .threads(4) // How many threads will use NIO server?\n                .maxRequestSize(1024 * 1024 * 20) // Set maximum request size to 20MB\n                .build();\n\n        // Register middleware with priority 0.\n        // Middlewares will be called from lowest to highest priority\n        yuno.middleware(MyHandlers::middle, 0); \n        \n        yuno.get(\"/\", MyHandlers::root); // Register route with method GET at /\n        yuno.listen(\":8080\"); // Let's start Yuno!\n    }\n}\n\npublic class MyHandlers {\n\n    // Middleware\n    public static void middle(Request request, Response response) throws Exception {\n        System.out.println(\"Called middleware\");\n        request.putLocal(\"foo\", \"bar\"); // Put some data to locals, we can access it later\n    }\n\n    // Endpoint\n    public static void root(Request request, Response response) throws Exception {\n    \tString name = request.param(\"name\"); // Get value from \"name\" parameter (from URL)\n        String accept = request.header(\"Accept\"); // Get value from \"Accept\" header\n        String foo = request.local(\"foo\"); // Get value from \"foo\", middleware put it there\n        \n        if (response.header(\"Content-Type\").equals(\"application/x-www-form-urlencoded\")) {\n            // Let's get data from request's body\n            Map\u003cString, String\u003e body = (Map\u003cString, String\u003e) request.body(); \n            System.out.println(body);\n        }\n    \t\n        if (name == null || !name.equals(\"mikigal\")) {\n            response.setStatus(HttpStatus.BAD_REQUEST); // Set response status to 400\n            response.setHeader(\"Foo\", \"Bar\"); // Set header \"Foo\" to \"Bar\"\n            response.close(); // Let's tell client to close connection, instead of stay with keep-alive\n            return;\n        }\n        \n        response.html(\"\u003chtml\u003e\u003chead\u003e\u003c/head\u003e\u003cbody\u003e\u003cp\u003eHello!\u003c/p\u003e\u003c/body\u003e\u003c/html\u003e\"); // Send HTML code\n        response.json(new MyObject(\"foo\", \"bar\")); // Send serialized MyObjects as JSON\n        response.file(new File(\"/Users/mikigal/Desktop/image.png\")); // Send file\n        response.binary(someBytesInArray, \"application/octet-stream\"); // Send byte array with selected Content-Type\n        response.redirect(\"/example\", HttpStatus.MOVED_PERMANENTLY); // Redirect to /example\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikigal%2Fyunoframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikigal%2Fyunoframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikigal%2Fyunoframework/lists"}