{"id":15133330,"url":"https://github.com/marcusoftnet/static-now","last_synced_at":"2026-02-04T08:31:17.936Z","repository":{"id":27265095,"uuid":"30737729","full_name":"marcusoftnet/static-now","owner":"marcusoftnet","description":"The fast track to serve up static files","archived":false,"fork":false,"pushed_at":"2017-03-23T10:55:09.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-10T12:56:33.835Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcusoftnet.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-02-13T03:03:31.000Z","updated_at":"2016-12-22T11:26:08.000Z","dependencies_parsed_at":"2022-09-16T22:50:39.881Z","dependency_job_id":null,"html_url":"https://github.com/marcusoftnet/static-now","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/marcusoftnet/static-now","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusoftnet%2Fstatic-now","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusoftnet%2Fstatic-now/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusoftnet%2Fstatic-now/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusoftnet%2Fstatic-now/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcusoftnet","download_url":"https://codeload.github.com/marcusoftnet/static-now/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusoftnet%2Fstatic-now/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265212016,"owners_count":23728509,"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-09-26T05:00:56.805Z","updated_at":"2026-02-04T08:31:12.909Z","avatar_url":"https://github.com/marcusoftnet.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# static-now\n\"But I just want so serve up some files... why all of this setup\". Have you ever said that to yourself.\n\nWorry no more - static-now is here to help you. With a single line your web server is ready to roll, and you can focus on the static files instead.\n\n```javascript\nrequire(\"static-now\")();\n```\n\nThis will start a [Koa](http://www.koajs.com) web server on port 3000 and start listening.\n\nYou can do it on two lines also for readability\n```javascript\nvar staticnow = require(\"static-now\");\nstaticnow();\n```\n\n# Starting the application\n\nStarting the app could not be simpler:\n\n```bash\nnode app.js\n```\n\nStart you application with the harmony features enabled, for older versions of Node:\n\n```bash\nnode --harmony app.js\n```\n\nHere's a package.json node ready for you so that you can use ```npm start```:\n\n```javascript\n\"scripts\": {\n\t\"start\": \"node app.js\"\n}\n```\n\n# Configuration\nThere's just a few configuration options that you can use to control the behaviour of static-now.\n\n## Directory\n\n```javascript\nvar options = { directory : __dirname };\nrequire(\"static-now\")(options);\n```\n\nBy default the directory that node is started in is used. Meaning if you go ```node app.js``` in ```/Volumes/Users/marcus/demo``` the files in that directory will be exposed via the web server.\n\n## Port\n\n```javascript\nvar options = { portnumber : 3456 };\nrequire(\"static-now\")(options);\n```\n\nThis will serve up the site at `http://localhost:3000`\n\nBy default port 3000 is used, meaning that your web server is started at  `http://localhost:3000 `.\n\nFor hosting in Heroku, or other platform as a service providers, you can use a process parameter to get the correct port. Like so:\n\n```javascript\nvar options = { portnumber : process.env.PORT };\nrequire(\"static-now\")(options);\n```\n\n## Autostart\n```javascript\nvar options = { autostart : false };\nvar app = require(\"static-now\")(options);\n```\n\nYou don't have to start the application right away, if you don't have too. The static-now function returns the Koa application so that you can start it yourself, when appropriate.\n\nA good time when this can be handy is for testing, when usually the testing framework is starting the application up. Like this, using [supertest](http://npmjs.org/package/supertest)\n\n```javascript\nvar supertest = require('supertest');\nvar staticNow = require('static-now');\n\ndescribe('Starting app via supertest', function () {\n\tit('here is how', function (done) {\n\n\t\tvar options = { autostart : false };\n\t\tvar app = staticNow(options);\n\n\t\t// Let supertest start listening\n\t\tvar request = supertest.agent(app.listen());\n\t\trequest\n\t\t\t.get('/README.md')\n\t\t\t.expect(200)\n\t\t\t.end(done);\n\t});\n});\n```\n\n## Log message\n```javascript\nvar options = { log : true };\nvar app = require(\"static-now\")(options);\n```\n\n`static-now` spits out some log messages showing you the current configuration etc. You can turn that off or on using the *log* option.\n\n# LICENSE\n[The MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcusoftnet%2Fstatic-now","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcusoftnet%2Fstatic-now","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcusoftnet%2Fstatic-now/lists"}