{"id":18896134,"url":"https://github.com/udivankin/pico-static-server","last_synced_at":"2025-04-15T01:34:18.509Z","repository":{"id":57323909,"uuid":"103399986","full_name":"udivankin/pico-static-server","owner":"udivankin","description":"Tiny yet fully functional functional Node.js static files server with zero dependencies written with ES6.","archived":false,"fork":false,"pushed_at":"2018-07-24T09:51:12.000Z","size":80,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-22T19:20:23.609Z","etag":null,"topics":["http-server","nodejs","static-server"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/udivankin.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":null,"support":null}},"created_at":"2017-09-13T12:57:42.000Z","updated_at":"2023-08-31T10:59:06.000Z","dependencies_parsed_at":"2022-09-09T09:21:40.292Z","dependency_job_id":null,"html_url":"https://github.com/udivankin/pico-static-server","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udivankin%2Fpico-static-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udivankin%2Fpico-static-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udivankin%2Fpico-static-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udivankin%2Fpico-static-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/udivankin","download_url":"https://codeload.github.com/udivankin/pico-static-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248989545,"owners_count":21194612,"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-server","nodejs","static-server"],"created_at":"2024-11-08T08:32:38.946Z","updated_at":"2025-04-15T01:34:18.198Z","avatar_url":"https://github.com/udivankin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pico-static-server\nTiny yet fully functional Node.js zero-dependencies static files server with **HTTPS** support.\n\n### Install\nVia npm:\n\n```bash\nnpm install --save pico-static-server\n```\n\n### Example\n\nYou can start right away by running \n```bash\nnode ./examples/pico-http-server.js\n```\nassuming you've put your content into ``./examples/static/`` folder.\n\n*HTTPS* example requires you to generate SSL cerificates first:\nGenerate 2048-bit RSA private key and remove the password from generated key\n```bash\nopenssl genrsa -des3 -passout pass:x -out localhost.pem 2048 \u0026\u0026 openssl rsa -passin pass:x -in localhost.pem -out localhost.key \u0026\u0026 rm localhost.pem\n```\nGenerate a Certificate Signing Request (CSR)\n```bash\nopenssl req -new -key localhost.key -out localhost.csr\n```\nGenerate a self-signed certificate that is valid for 365 days with sha256 hash and remove CSR\n```bash\nopenssl x509 -req -sha256 -days 365 -in localhost.csr -signkey localhost.key -out localhost.crt \u0026\u0026 rm localhost.csr\n```\n\nThen install generated certificate in system, mark as trusted and you are ready:\n```bash\nnode ./examples/pico-https-server.js\n```\n\n### Usage\n\nYou may want to create your own static HTTP server:\n\n```javascript\n  const createServer = require('pico-static-server');\n\n  const staticServer = createServer({\n    defaultFile: 'index.html',  // defaults to 'index.html'\n    staticPath: './static',     // defaults to './'\n    port: 8080,                 // defaults to 8080\n  });\n```\nor even *HTTPS* one: \n```javascript\n  const createServer = require('pico-static-server');\n\n  const staticServer = createServer({\n    defaultFile: 'index.html',         // defaults to 'index.html'\n    staticPath: __dirname + '/static', // defaults to './'\n    port: 8080,                        // defaults to 8080\n    protocol: 'https',                 // defaults to 'http'\n    cert: __dirname + '/localhost.crt',\n    key: __dirname + '/localhost.key',\n  });\n```\n\ncreateServer() returns an instance of [http.Server](https://nodejs.org/api/http.html) or [https.Server](https://nodejs.org/api/https.html) to give you control over it if needed\n\nMIT found in `LICENSE` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudivankin%2Fpico-static-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fudivankin%2Fpico-static-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudivankin%2Fpico-static-server/lists"}