{"id":18469762,"url":"https://github.com/valen-h/server-ii","last_synced_at":"2026-05-02T05:03:01.936Z","repository":{"id":143795702,"uuid":"184901034","full_name":"Valen-H/Server-II","owner":"Valen-H","description":"A Server framework with middleware support.","archived":false,"fork":false,"pushed_at":"2019-05-30T15:20:52.000Z","size":37,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"staging","last_synced_at":"2025-05-12T11:52:50.049Z","etag":null,"topics":["fs","http","middleware","node","server","static","templates","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Valen-H.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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":"2019-05-04T13:51:38.000Z","updated_at":"2021-08-23T07:50:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"6856d59f-1dc4-45c6-b7f8-f5ffed4efadd","html_url":"https://github.com/Valen-H/Server-II","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Valen-H/Server-II","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Valen-H%2FServer-II","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Valen-H%2FServer-II/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Valen-H%2FServer-II/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Valen-H%2FServer-II/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Valen-H","download_url":"https://codeload.github.com/Valen-H/Server-II/tar.gz/refs/heads/staging","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Valen-H%2FServer-II/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261534888,"owners_count":23173488,"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":["fs","http","middleware","node","server","static","templates","typescript"],"created_at":"2024-11-06T10:11:41.074Z","updated_at":"2026-05-02T05:02:56.916Z","avatar_url":"https://github.com/Valen-H.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"  \n# V-Serv-II  \n  \n***  \n  \n## Features  \n  \n1. Middlewares  \n    * Propagating  \n    * Builtin / Custom  \n2. Content-Type mapping  \n3. Path-URL mapping customization  \n4. Port customization  \n5. Templating/Indexing  \n6. Event-Oriented  \n7. Caching  \n  \n### (Builtin) Middlewares  \n  \n1. fix - Fixes incorrect URLs  \n    * TODO: .xjs -\u003e .jsx etc...  \n2. directory - Serves index or performs directory indexing  \n    * .noindex (customisable) - empty to block indexing, fill to block specific files  \n    * files starting with '__' (customisable) - blocked from indexing by default  \n    * TODOs: .notmpl - no templating (for .jsx files mostly), and a special request to fetch raw and bypass translation  \n3. static - Serves raw content and compiles templated content  \n    * TODO: Add caching  \n    * Templated content: .xjs, .htmx, .htmlx, .cssx  \n4. end - Applies appropriate headers and ends requests  \n5. TODO: secure - Prevents bruteforcing / DoS (-\u003e HTTP 429)  \n  \n\u003e Templated content example.htmx: `Hello $$usr$$!`. Translated during serving, change templating characters through server options.  \n  \n## Usage  \n  \n```javascript\nconst server = require(\"vale-server-ii\").Server,\n  classes = require(\"../dist/lib/Classes\").Classes;\n\nasync function start() {\n  srv = await server.setup({ });  /**@param {Classes.Options.ServerOptions} opts - leave empty fields for default*/\n  await srv.bind();  //listen()\n  await srv.bind(new classes.Middleware(\"test\", [ \"end\" ], [ \"static\" ], async function body(req, res, event) {\n      event.server._debug(event.reqcntr, \"(TEST.TS) PASSED.\");\n      return event.pass(\"passed\");\n    }\n  ));  //bind custom middleware\n  console.debug(\"Server started...\");\n  srv.on(\"log\", console.log);\n  srv.on(\"request\", (req, res) =\u003e console.debug(\"(INDEX.JS) REQ:\", req.url));\n} //start\n\nstart();\n```  \n  \n\u003e Enable builtin middlewares with the `allowmw` option.  \n\u003e Also take a look in `Classes` to see how things work  \n  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalen-h%2Fserver-ii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalen-h%2Fserver-ii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalen-h%2Fserver-ii/lists"}