{"id":15676542,"url":"https://github.com/shadowtime2000/eon","last_synced_at":"2025-03-30T06:28:11.197Z","repository":{"id":143808165,"uuid":"298411563","full_name":"shadowtime2000/eon","owner":"shadowtime2000","description":"A simple framework for creating web services","archived":false,"fork":false,"pushed_at":"2020-11-12T17:02:43.000Z","size":852,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-05T08:35:19.993Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shadowtime2000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-24T22:46:44.000Z","updated_at":"2022-06-13T18:13:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d3c60a2-8037-4eba-90bd-9e8a53be717f","html_url":"https://github.com/shadowtime2000/eon","commit_stats":{"total_commits":173,"total_committers":3,"mean_commits":"57.666666666666664","dds":0.1502890173410405,"last_synced_commit":"fbb958a3eeee867b35ce7561f360f1278f3afc05"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowtime2000%2Feon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowtime2000%2Feon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowtime2000%2Feon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowtime2000%2Feon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shadowtime2000","download_url":"https://codeload.github.com/shadowtime2000/eon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246285654,"owners_count":20752947,"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":"2024-10-03T16:03:08.354Z","updated_at":"2025-03-30T06:28:11.177Z","avatar_url":"https://github.com/shadowtime2000.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\u003cimg src=\"logo-small.png\" height=\"28px\"/\u003e Eon.js\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\nA simple framework for creating web services\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://res.cloudinary.com/db3degzpn/image/upload/v1599479042/cover_spor65.png\" width=\"100%\" height=\"auto\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/eonjs\" alt=\"version badge\"\u003e\n\u003cimg src=\"https://img.shields.io/npm/l/eonjs\" alt=\"license badge\"\u003e\n\u003cimg src=\"https://img.shields.io/github/languages/code-size/eon-web/eon\" alt=\"size badge\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/dependencies-none-brightgreen\" alt=\"dependency badge\"\u003e\n\u003cimg src=\"https://img.shields.io/npm/dw/eonjs?logo=npm\" alt=\"downloads badge\"\u003e\n\u003cimg src=\"https://img.shields.io/github/issues/eon-web/eon\" alt=\"issues badge\"\u003e\n\u003cimg src=\"https://img.shields.io/github/issues-closed/eon-web/eon\" alt=\"closed issues badge\"\u003e\n\u003cimg src=\"https://img.shields.io/github/issues-pr/eon-web/eon\" alt=\"pr badge\"\u003e\n\u003cimg src=\"https://img.shields.io/github/stars/eon-web/eon\" alt=\"stars badge\"\u003e\n\u003cimg src=\"https://img.shields.io/website?down_color=red\u0026down_message=down.%20please%20report%20this%20to%20the%20repo%20owner\u0026up_color=brightgreen\u0026up_message=up\u0026url=https%3A%2F%2Feon.js.org\u0026cachebust=1\" alt=\"website badge\"\u003e\n\u003cimg src=\"https://img.shields.io/github/commit-activity/m/eon-web/eon?foo=bar\" alt=\"commit badge\"\u003e\n\u003cimg src=\"https://img.shields.io/bundlephobia/min/eonjs\" alt=\"size badge\"\u003e\n\u003cimg src=\"https://img.shields.io/github/repo-size/eon-web/eon\" alt=\"repo size badge\"\u003e\u003c/p\u003e\n\n## Why Eon?\nYes, another web server framework. Whenever a new one comes out, you have to ask yourself: Do I need this? Am I fine to just continue using express/fastify/etc...? I want to present to you the reasons why I began writing this framework and hopefully make your decision a bit easier.\n\n### Express is _not_ a small framework\nExpress is great, because it provides lots of features, but that also makes it a quite large library. With Eon, I tried to reduce the bundle size by writing as much code as possible on my own and adding only the necessary features.\n\n### 0 Dependencies\nAs of `v1.11.x`, Eon.js has *no dependencies whatsoever*, thereby further reducing the bundle size and overhead of additional packages to manage.\n\n# Installation\nTo install eon, simply run\n```bash\nnpm i eonjs@latest --save\n```\n\n# Examples \u0026 Usage\nHere is an example of using Eon:\n```js\n// Require Eon\nconst eon = require('eonjs');\n// Create App\n// Shorthand: const app = require('eonjs')(8080);\nconst app = eon(8080);\n// Create a get path\napp.get('/').json((req, res) =\u003e ({hello: 'world', how_are: 'you?'}));\n```\n\n## Typescript\nThis framework has Typescript typings bundled with it.\n\n# API\nAPI referenece. **Please Refer to the full documentation at [eon.js.org](https://eon.js.org/#/)**\n\n## Plugins API\n**New In v1.15**: Version 1.15 introduces the new Plugins API. I decided to take the time, rather sooner than later, to rewrite Eon into an \"everything's-a-plugin\" type of system. The full Plugin docs will be available soon at [eon.js.org](https://eon.js.org).\n\n### `eon(port): EonWebEngine`\nThis function is the default export of the Eon library. It will create a new EonWebEngine instance.\n\n## Class: `EonWebEngine`\nAn instance of this class is created by `require('eon')(\u003cport\u003e)`;\n\n### `constructor`\nArgs:\n- `port:number` The port to listen on\n\n### `get(path):Path`\nRegisters a new GET listener on `path`.\n\nArgs:\n- `path:string` The pathname to register the listener on. Examples: `\"/\"`, `\"/test\"`\n\nReturns: `GETPath extends Path`\n\n### `post(path):Path`\nRegisters a new POST listener on `path`.\n\nArgs:\n- `path:string` The pathname to register the listener on. Examples: `\"/\"`, `\"/test\"`\n\nReturns: `POSTPath extends Path`\n\n### `listen([callback]):void`\nListens on the port specified by the constructor.\n\nArgs:\n- `callback?:function(port)` (optional) Will be called once the server is listening. Arguments: The port the server is listening on.\n\nReturns: `void`\n\n## Class: `Path`\nA path listener\n\n### `text(callback):EonWebEngine`\nWhen a request is received on this path, the text returned from `callback(req, res)` will be sent to the client.\n\nArgs:\n- `callback:function(req:IncomingHTTPData, res:OutgoingHTTPData)` The request handler\n\nReturns: `EonWebEngine` The Engine that created it.\n\n### `json(callback):EonWebEngine`\nLike `Path.text()` but will run `JSON.stringify` on callback output before sending\n\n### `hook(callback):EonWebEngine`\nLike `Path.text()`, but expects the callback to send data itself\n\nArgs:\n- `callback:function(req:IncomingHTTPData, res:OutgoingHTTPData)` The request handler\n\nReturns: `EonWebEngine` The Engine that created it.\n\n## Class: `IncomingHTTPData`\nAn incoming HTTP request\n\n### field: `whatwg:URL`\nA parsed `URL` object ([see nodejs URL docs](https://nodejs.org/api/url.html#url_url_strings_and_url_objects))\n\n### field: `method:string`\nThe request method ('GET', 'POST', 'PUT', etc..)\n\n### field: `headers:object`\nThe request headers ([see nodejs http docs](https://nodejs.org/api/http.html#http_message_headers))\n\n### field: `rawHeaders:object`\nThe unprocessed request headers ([see nodejs http docs](https://nodejs.org/api/http.html#http_message_rawheaders))\n\n### field: `url:string`\nThe full request url, without protocol and host. Example: `/p/a/t/h?name=john\u0026lastname=doe#info`\n\n### field: `pathname:string`\nalias for `IncomingHTTPData.whatwg.pathname`\n\n### field: `query:object`\nThe parsed querystring (Only available for GET requests)\n\n### field: `body:object`\nThe parsed post/put body (Only available for Non-GET requests **after the** `body` **event has fired**)\n\n### event: `body`\nFired on POST-like requests after the body is received and parsed\n\nArguments to handler: none\n\n### `on(event, handler)`\nRegister an event handler. Multiple handlers can be registed for one event. **Handlers cannot be unregistered**\n\nArgs:\n- `event:string` Name of the event to listen for\n- `handler:function(...args)` The handler to call when the event is fired\n\n## Class: `OutgoingHTTPData`\nAn outgoing HTTP response. Passed as second argument to request handlers\n\n### field: `endend:boolean`\nWether the stream has been closed\n\n### `status(code):OutgoingHTTPData`\nSets the response status\n\nArgs:\n- `code:number` The status code to send\n\nReturns: `OutgoingHTTPData` The object it was called on\n\n### `header(name, value):OutgoingHTTPData`\nSets a response header\n\nArgs:\n- `name:string` The name of the header\n- `value:string` The value of the header\n\nReturns: `OutgoingHTTPData` The object it was called on\n\n### `getHeader(name):string`\nReturns the value of a header\n\nArgs:\n- `name:string` The name of the header to retrieve\n\nReturns `string` The value of the header\n\n### `write(data):OutgoingHTTPData`\nSends data to the client\n\nArgs:\n- `data:string` The data to write\n\nReturns: `OutgoingHTTPData` The object it was called on\n\n### `end(data):OutgoingHTTPData`\nLike `write()` but will close the stream\n\nReturns: `OutgoingHTTPData` The object it was called on\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowtime2000%2Feon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadowtime2000%2Feon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowtime2000%2Feon/lists"}