Static file server for diet based on send. A streaming static file server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework.
npm install diet-static
// Initialize Servervar server = // Require Dietvar app = // Create Appapp // Configure Domain// Require diet-staticvar static = path: apppath+'/static'// Attach static as a global footerapp;
Now your app will serve every URL with a file that has a mimeType and it's NOT associated with a custom route by
app.post relative to the path configration.
// --> `/path/to/your_app/static/people.json`// --> `/path/to/your_app/static/favicon.ico`// --> `/path/to/your_app/static/scripts/global.js`// --> `/path/to/your_app/static/styles/global.css`// --> `/path/to/your_app/static/images/logo.png`
Configs are optional for
path: apppath+'/static' // the folder to server files from
(The MIT License)
Copyright (c) 2014 Halász Ádám firstname.lastname@example.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.