{"id":26356972,"url":"https://github.com/redroserade/gladius","last_synced_at":"2025-10-25T15:14:25.072Z","repository":{"id":148930923,"uuid":"29062117","full_name":"RedRoserade/gladius","owner":"RedRoserade","description":"A basic, middleware-based application that runs on top of a dart HttpServer. Heavily inspired by Express JS and OWIN.","archived":false,"fork":false,"pushed_at":"2015-01-17T14:51:06.000Z","size":168,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T13:37:07.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","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/RedRoserade.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-10T15:56:53.000Z","updated_at":"2023-03-10T22:46:03.000Z","dependencies_parsed_at":"2023-03-30T05:03:09.901Z","dependency_job_id":null,"html_url":"https://github.com/RedRoserade/gladius","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RedRoserade/gladius","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedRoserade%2Fgladius","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedRoserade%2Fgladius/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedRoserade%2Fgladius/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedRoserade%2Fgladius/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RedRoserade","download_url":"https://codeload.github.com/RedRoserade/gladius/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedRoserade%2Fgladius/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263296493,"owners_count":23444494,"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":[],"created_at":"2025-03-16T13:33:08.418Z","updated_at":"2025-10-25T15:14:20.025Z","avatar_url":"https://github.com/RedRoserade.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gladius\n\nA basic, middleware-based application that runs on top of a dart `HttpServer`. Heavily inspired by Express and OWIN. Not intended for use (at least, not yet).\n\n## Usage\n\nSimilar to OWIN, this works based on request delegates and app functions. \n\nAn app function (`AppFunc`) is a function that uses a `Context` and returns a `Future`.\n\nA request delegate is a function that takes an `AppFunc` and returns an `AppFunc`,\nand these are used to compose the request pipeline. The `AppFunc` that is received through\nparameter is the next middleware in the pipeline.\n\nThere are many ways `next()` can be called. One can call it at the end of the method,\nwhich means the only processing done will be in the inbound request, before it's passed along. \nIt can also be called in the \"middle\" of the method (see below). This can be used for logging,\nor error handling. One can also call it immediately, and have the middleware process the response\nitself (for example, compression).\nOf course, one can also not call `next()` at all, in which, the pipeline is short-circuited,\nthe preceeding middleware finishes processing, and the response is sent.  \n\n```dart\nmain() {\n  var app = new HttpApp();\n  \n  app.address = '0.0.0.0';\n  app.port = 8080;\n  \n  // A simple request logger.\n  // Here, next() is called in the middle of\n  // the method, so that timing can be done.\n  app.use((AppFunc next) =\u003e (Context ctx) async {\n    var sw = new Stopwatch();\n    sw.start();\n    \n    await next(ctx);\n    \n    sw.stop();\n    \n    print('${ctx.request.method} ${ctx.request.path} - ${sw.elapsed.inMilliseconds}');\n  });\n  \n  // A simple 'hello, world'. Since next() isn't\n  // called, the pipeline ends here.\n  // This is invoked when the logger calls next(),\n  // so, when this ends, the logger will continue execution.\n  app.use((AppFunc next) =\u003e (Context ctx) {\n    ctx.response.write('Hello, world!');\n  });\n  \n  app.start();\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredroserade%2Fgladius","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredroserade%2Fgladius","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredroserade%2Fgladius/lists"}