Serve static assets for BlueGate applications
npm install bluegate-staticBlueGate Static
==================




Serve static assets in a BlueGate application.
This module is intended for small amounts of files, such as CSS-files and images.
The list of available paths is generated on startup. A single file read is executed
when requesting a file. This has advantages for performance and security, but is not
suitable for many files or user uploads.
Install using `npm install bluegate-static
Serve static files in /assets folder.`javascript
var BlueGate = require('bluegate');
var app = new BlueGate();
app.listen(8080);
require('bluegate-static')(app);
`
The following options can be provided:
* filepath is the basepath on the local file system.
* webpath is the basepath on the website.
* files is the pattern, parsed by the globby module.
All files are served on "/webpath/relativepath", where "relativepath" is the path on the local
filesystem without the path provided infilepath.
Example to serve files in "css", "js" and "images" directories.
`javascript
var BlueGate = require('bluegate');
var app = new BlueGate();
app.listen(8080);
require('bluegate-static')(app, {
filepath: '',
webpath: '/',
files: '{css,js,images}/*/.{css,js,png,gif,jpg,jpeg,svg,woff,woff2,eot,ttf}'
});
`
This module includes a list of common
built-in MIME-types.
You can however specify extra MIME-types in the options.
`javascript``
require('bluegate-static')(app, {
mimeTypes: {test: 'application/x-test'}
});