An electrode-server decor to serve static files using inert
npm install electrode-static-paths[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]
Electrode Server Decor to serve static files using [inert].
Install
```
$ npm i electrode-static-paths --save
`js
const electrodeServer = require("electrode-server");
electrodeServer( config, [require("electrode-static-paths")()] );
`
By default, the static files are served from dist under CWD.
* Route /html will serve files from dist/html/js
* Route will serve files from dist/js/images
* Route will serve files from dist/images
You can change the prefix dist with pathPrefix in options to the electrodeStaticPaths plugin.
You can add a route prefix with routePrefix option.
For example:
`js`
const config = {
plugins: {
electrodeStaticPaths: {
options: {
routePrefix: "/test",
pathPrefix: "myfiles"
}
}
}
};
You can override the /html, /js, and /images routes with routes option.
For example, if you only want to serve files at /js, then:
`js`
{
plugins: {
electrodeStaticPaths: {
options: {
routes: [ "js" ]
}
}
}
}
You can also specify configs to be passed to server.route:
`js``
const config = {
plugins: {
electrodeStaticPaths: {
options: {
config: {
}
}
}
}
};
Built with :heart: by Team Electrode @WalmartLabs.
[inert]: https://github.com/hapijs/inert
[npm-image]: https://badge.fury.io/js/electrode-static-paths.svg
[npm-url]: https://npmjs.org/package/electrode-static-paths
[travis-image]: https://travis-ci.org/electrode-io/electrode-static-paths.svg?branch=master
[travis-url]: https://travis-ci.org/electrode-io/electrode-static-paths
[daviddm-image]: https://david-dm.org/electrode-io/electrode-static-paths.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/electrode-io/electrode-static-paths