{"id":17715633,"url":"https://github.com/jmjuanes/stattic","last_synced_at":"2025-03-31T11:23:07.204Z","repository":{"id":57370277,"uuid":"48054148","full_name":"jmjuanes/stattic","owner":"jmjuanes","description":"Ridiculous simple script for serving static files.","archived":false,"fork":false,"pushed_at":"2019-05-18T23:53:46.000Z","size":38,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T18:09:25.905Z","etag":null,"topics":["nodejs-server","static","static-files","static-server","static-site"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/stattic","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/jmjuanes.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":"2015-12-15T16:07:31.000Z","updated_at":"2024-07-14T23:58:25.000Z","dependencies_parsed_at":"2022-09-18T22:30:21.840Z","dependency_job_id":null,"html_url":"https://github.com/jmjuanes/stattic","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmjuanes%2Fstattic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmjuanes%2Fstattic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmjuanes%2Fstattic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmjuanes%2Fstattic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmjuanes","download_url":"https://codeload.github.com/jmjuanes/stattic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246458789,"owners_count":20780823,"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":["nodejs-server","static","static-files","static-server","static-site"],"created_at":"2024-10-25T12:06:33.856Z","updated_at":"2025-03-31T11:23:07.181Z","avatar_url":"https://github.com/jmjuanes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stattic\n\n[![npm](https://img.shields.io/npm/v/stattic.svg?style=flat-square)](https://www.npmjs.com/package/stattic)\n[![npm](https://img.shields.io/npm/dt/stattic.svg?style=flat-square)](https://www.npmjs.com/package/stattic)\n[![Dependency Status](https://david-dm.org/statticjs/stattic.svg?style=flat-square)](https://david-dm.org/statticjs/stattic)\n[![npm](https://img.shields.io/npm/l/stattic.svg?style=flat-square)](https://github.com/jmjuanes/stattic)\n\nRidiculous simple script for serving static files using `http` module.\n\n\n## Installation\n\nInstall it using NPM:\n\n```sh\nnpm install stattic --save\n```\n\n## Usage\n\nExample of a very simple server that shows all the static files on the `public` folder:\n\n```javascript\n//Import stattic\nlet stattic = require(\"stattic\");\n\n//Run the web server\nstattic({\n    \"folder\": \"./public\",\n    \"port\": 5000\n});\n```\n\n## API\n\n#### stattic(options)\n\nStarts a new server with the configuration specified in the `options` object. The following table lists the available options:\n\n| key | Description | Type | Default value |\n|-----|-------------|------|---------------|\n| folder | Sets the path of your static files folder. | String | `./` |\n| port | Sets the port of your server. | Integer | `5000` |\n| cors | Enable cross-origin resource sharing (CORS). | Boolean | `false` |\n| index | Sets the index file name. | String | `index.html` |\n\n\n## CLI usage\n\nYou can install the CLI by running the following command: \n\n```\nnpm install -g stattic\n```\n\nNow you can navigate to a folder with your static files and initialize a static server: \n\n```\ncd /path/to/your/static/content/\nstattic --port 5000 --cors\n```\n\nThis will start a new static server in the port `5000` that will serve all files placed in the current folder.\n\n### CLI options \n\n#### --port PORT \n\nSpecify the port for your static server. Default is `5000`.\n\n#### --folder FOLDER\n\nYou can specify a different folder to serve the static files. Example \n\n```\nstattic --port 5000 --folder /path/to/your/static/content/\n```\n\n#### --cors \n\nUse this option to enable cors.\n\n\n\n## License\n\n[MIT LICENSE](./LICENSE) \u0026copy; Josemi Juanes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmjuanes%2Fstattic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmjuanes%2Fstattic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmjuanes%2Fstattic/lists"}