# awesome-static

> Koa static file serving middleware base on [`koa-send`](https://github.com/koajs/send).

Latest version **1.4.3** (published 2019-01-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install awesome-static
pnpm add awesome-static
yarn add awesome-static
bun add awesome-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.4.3 |
| Published | 2019-01-25 |
| First published | 2019-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | younccat |

## Links

- npm: https://www.npmjs.com/package/awesome-static
- npm.io page: https://npm.io/package/awesome-static

## Dependencies (3)

- [koa](https://npm.io/package/koa.md) ^2.6.2
- [koa-send](https://npm.io/package/koa-send.md) ^5.0.0
- [prettier](https://npm.io/package/prettier.md) ^1.16.1

## Recent versions

- 1.4.3 (latest) — 2019-01-25
- 1.3.3 — 2019-01-24
- 1.3.2 — 2019-01-24
- 1.3.1 — 2019-01-24
- 1.3.0 — 2019-01-24
- 1.2.0 — 2019-01-24
- 1.1.0 — 2019-01-24
- 1.0.0 — 2019-01-24

## README

# Awesome-Static [![Build Status](https://www.travis-ci.org/HaoDaWang/awesome-static.svg?branch=master)](https://www.travis-ci.org/HaoDaWang/awesome-static) ![npm](https://img.shields.io/badge/npm-v7.0.0-blue.svg) ![TypeScript](https://badges.frapsoft.com/typescript/awesome/typescript.png?v=101)

Koa static file serving middleware base on [`koa-send`](https://github.com/koajs/send).

## Feature

Some new features compared to koa-static.

- :monkey:Set the route map to static file directory
- :sunny:More than `GET` and `HEAD`
- :coffee:Develop with Typescript

## Installation

#### npm

```
npm install awesome-static
```

#### yarn

```
yarn add awesome-static
```

## Usage

```javascript
const Koa = require('koa');
const static = require('awesome-static');
const app = new Koa();

app.use(
  static('public', {
    allowMethods: ['GET', 'HEAD', 'POST'],
    route: 'hello',
  }),
);

app.listen(8080);
```

See `/example`.

## API

```javascript
AwesomeStatic(root, options);
```

- `root` root directory string. nothing above this root directory can be served (Type: `string`).
- `options` options object (Type:`AwesomeOptions`).

#### [Type] AwesomeOptions

Extends options from `koa-static`

- `route` route for mapping to a static server (Type:`string`).
- `allowMethods` HTTP method for allow access static file (Type:`HTTPMethod`).

#### [Type] HTTPMethod

`GET` | `HEAD` | `POST` | `PUT` | `DELETE`

## License

MIT

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