Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 1.97 KB

README.md

File metadata and controls

61 lines (48 loc) · 1.97 KB

Rill
@rill/static
API stability Standard NPM version Downloads Gitter Chat

A static file server for Rill. Internally node-static is used and all options are valid.

Installation

Npm

npm install @rill/static

Example

const app = require('rill')()
const static = require('@rill/static')

// Directory can be relative to where node_modules are installed or an absolute path.
// Cache time will use the `ms` module to parse time strings, otherwise use milliseconds.
app.use(static('public', { gzip: true, cache: '30 days' }))

// You can also serve a directory at a specific path.
app.at('/assets/*', server('assets_folder')) // -> /assets/test.txt will look in project/assets_foler/test.txt

API

static(directory, options) - All files in the provided directory will automatically be served.

Contributions

  • Use npm test to run tests.

Please feel free to create a PR!