# bluegate-static

> Serve static assets for BlueGate applications

Latest version **1.0.0** (published 2016-11-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install bluegate-static
pnpm add bluegate-static
yarn add bluegate-static
bun add bluegate-static
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-11-04 |
| First published | 2016-11-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.12.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Maurits Lawende |
| Maintainers | mauritsl |
| Keywords | bluegate, static, assets |

## Links

- npm: https://www.npmjs.com/package/bluegate-static
- Repository: https://github.com/mauritsl/bluegate-static
- Homepage: https://github.com/mauritsl/bluegate-static#readme
- Issues: https://github.com/mauritsl/bluegate-static/issues
- npm.io page: https://npm.io/package/bluegate-static

## Dependencies (3)

- [globby](https://npm.io/package/globby.md) ^6.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.13.1
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.1

## Recent versions

- 1.0.0 (latest) — 2016-11-04

## README

BlueGate Static
==================

[![Build Status](https://travis-ci.org/mauritsl/bluegate-static.svg?branch=master)](https://travis-ci.org/mauritsl/bluegate-static)
[![Coverage Status](https://coveralls.io/repos/github/mauritsl/bluegate-static/badge.svg?branch=master)](https://coveralls.io/github/mauritsl/bluegate-static?branch=master)
[![Dependency Status](https://david-dm.org/mauritsl/bluegate-static.svg)](https://david-dm.org/mauritsl/bluegate)
[![Known Vulnerabilities](https://snyk.io/test/github/mauritsl/bluegate-static/badge.svg)](https://snyk.io/test/github/mauritsl/bluegate-static)

Serve static assets in a [BlueGate](https://www.npmjs.com/package/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.

## Installation

Install using ``npm install bluegate-static``

## Quick example

Serve static files in ``/assets`` folder.
```javascript
var BlueGate = require('bluegate');
var app = new BlueGate();
app.listen(8080);

require('bluegate-static')(app);
```

## Custom options

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](https://www.npmjs.com/package/globby) module.

All files are served on "/webpath/relativepath", where "relativepath" is the path on the local
filesystem without the path provided in``filepath``.

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}'
});
```

## MIME-types

This module includes a list of common
[built-in MIME-types](https://github.com/mauritsl/bluegate-static/blob/master/mimetypes.js).
You can however specify extra MIME-types in the options.

```javascript
require('bluegate-static')(app, {
  mimeTypes: {test: 'application/x-test'}
});
```

---
_Source: https://npm.io/package/bluegate-static · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
