{"id":15369255,"url":"https://github.com/developit/tinyserver","last_synced_at":"2025-09-14T02:12:43.687Z","repository":{"id":4601404,"uuid":"5744394","full_name":"developit/tinyserver","owner":"developit","description":"Ridiculously small CLI web server built using Node.JS.","archived":false,"fork":false,"pushed_at":"2013-03-04T07:00:12.000Z","size":116,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-12T00:45:41.487Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/developit.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}},"created_at":"2012-09-10T03:23:50.000Z","updated_at":"2023-09-25T07:46:00.000Z","dependencies_parsed_at":"2022-08-06T17:00:59.237Z","dependency_job_id":null,"html_url":"https://github.com/developit/tinyserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/developit/tinyserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Ftinyserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Ftinyserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Ftinyserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Ftinyserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developit","download_url":"https://codeload.github.com/developit/tinyserver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Ftinyserver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275051636,"owners_count":25396977,"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","status":"online","status_checked_at":"2025-09-14T02:00:10.474Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-01T13:34:51.783Z","updated_at":"2025-09-14T02:12:43.663Z","avatar_url":"https://github.com/developit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"tinyserver\n==========\nA very small CLI web server built using Node.JS.  \n\nUses\n----\n*A few things tinyserver might be able to help you out with:*\n\n- Quickly serving static files from a directory\n- Rapid prototyping of APIs. *(using the API Router module)*\n- Running a simple, manageable local server setup. *(instead of trying to manage mirroring a production setup)*\n- Serving up PHP in the **worst way you could possibly imagine**. [*(seriously, this is wrong on so many levels)*](server-modules/php.server.js)\n\n---\n\nRun a basic server\n==================\n\u003e *Listens on the default port of 8080, with all modules enabled.*  \n\u003e `node server.js`\n\nSpecify Options\n---------------\n\u003e Just pass them as space-separated key-value pairs.  \n\u003e `node server.js option1=value option2=value`\n\n\nAvailable Options\n-----------------\n\u003e `port` --- **Listen on the given port.**  \n\u003e *Defaults to 8080*\n\u003e \n\u003e `dir` --- **Serve content from the given directory**  \n\u003e *Defaults to the working directory.*\n\u003e \n\u003e `host` --- **Accept requests to the given hostname.**  \n\u003e *Defaults to \"\\*\" (all)*\n\u003e \n\u003e `modules_dir` --- **Where to look for modules**  \n\u003e *Defaults to \"./server-modules\"*\n\u003e \n\u003e `modules_ext` --- **File extension for modules**  \n\u003e *Defaults to \".server.js\"*\n\nExample\n-------\n```bash\nnode server.js port=1337 dir=$PWD\n```\n\n---\n\n---\n\nModules\n=======\n\nAliases `aliases.server.js`\n---------------------------\nAdds simple URL redirection and internal proxying, specified in a tiny configuration file.\n\n**Usage**  \nPlace a file `aliases` in your web root.  \nIt should contain a configuration of the following format:   \n\u003e\tStatements are newline-separated groups of \"`pattern` `[operator]` `replacement`\".  \n\u003e\t`[operator]` can be either `=\u003e` or `\u003e\u003e` - meaning `redirect` or `proxy`, respectively.  \n\u003e\tStatements are evaluated in-order until the first match is found.  \n\u003e\tFor comments, everything after a `#` character is omitted from each line.  \n\n*Redirect URLs matching a pattern:*  \n`/pattern/(.*?)$ =\u003e /replacement/$1`  \n\n*Proxy requests to URLs matching a pattern:*  \n`/another-pattern/(.*?)$ \u003e\u003e http://example.com/$1?foo=bar`  \n\n**Sample Config File**  \n```bash\n# Configuration for tinyserver alias module\n\n# Redirect index.html to root:\n/index.html =\u003e /\n\n# Proxy all API calls to production:\n/api/(.+)$ \u003e\u003e http://prod.example.com/api/$1\n\n# Make all app urls return the bootstrap HTML page:\n/app/(.+)$ \u003e\u003e /app/\n```\n\n---\n\nAPI Router `api.server.js`\n--------------------------\nAdds extremely basic API routing, and a `/server/info` API for querying the server's stats.\n\n**Usage**\nBy default, the module just exposes the `/server/info` API URL.  \nTo add your own routes, add server plugins written something like this:  \n\n```JavaScript\nprocess.nextTick(function() {\n\t// Ensure the API module exists\n\tif (!global.apiRoutes) {\n\t\treturn console.error('API module not available.');\n\t}\n\t\n\t// This is a \"modifier\" route, because it returns false. \n\t// Other matching routes will be executed.\n\tglobal.apiRoutes['^/api/.*$'] = function(matches, req, res) {\n\t\t// wait... is this middleware?\n\t\tres.reply = function(response) {\n\t\t\tthis.writeHead(200, {\n\t\t\t\t'content-type' : 'application/json'\n\t\t\t});\n\t\t\tthis.end(JSON.stringify(response));\n\t\t};\n\t\treturn false;\n\t};\n\t\n\t// This is a \"final\" route. \n\t// If the URL matches, no other routes will be executed.\n\tglobal.apiRoutes['^/api/login$'] = function(matches, req, res) {\n\t\t// use that silly middleware:\n\t\tres.reply({\n\t\t\tresult : true,\n\t\t\tmessage : \"Hello!\"\n\t\t});\n\t};\n});\n```\n\n---\n\nDirectory Listings `dirlist.server.js`\n--------------------------------------\nAdds HTML directory listings if you request a directory URL. They look intentionally similar to Apache's.\n\n**Usage**  \nNothing special to do here, just enable the module and it turns on directory listing pages.\n\n---\n\nPHP Horrible Idea That Should Never Have Been Written `php.server.js`\n---------------------------------------------------------------------\nAdds PHP scripting support in **the absolute most disgusting way possible**.  \n\u003e If you enable this on a public-facing server, you will get hacked.  \n\u003e Or at least laughed at.  \n\u003e By Me.  \n\n**Usage**  \nIf you have the module included, it will execute PHP scripts when they are requested (anything ending in .php).  \nIt's a disgusting crime against humanity, and you should be ashamed to even have read this.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopit%2Ftinyserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopit%2Ftinyserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopit%2Ftinyserver/lists"}