Skip to content

Commit

Permalink
doc: document multiple roots (#124)
Browse files Browse the repository at this point in the history
* doc: document multiple roots

Refs: #62
Closes: #120

* Update README.md

Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>

* Update README.md

Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>

Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>
  • Loading branch information
MylesBorins and Eomm committed May 1, 2020
1 parent 4c5aaa3 commit b3add45
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ fastify.get('/path/with/different/root', function (req, reply) {

```

### Multiple prefixed roots

```js
const fastify = require('fastify')()
const fastifyStatic = require('fastify-static')
const path = require('path')
// first plugin
fastify.register(fastifyStatic, {
root: path.join(__dirname, 'public')
})

// second plugin
fastify.register(fastifyStatic, {
root: path.join(__dirname, 'node_modules'),
prefix: '/node_modules/',
decorateReply: false // the reply decorator has been added by the first plugin registration
})

```

### Options

#### `root` (required)
Expand Down

0 comments on commit b3add45

Please sign in to comment.