0.3.19 • Published 12 months ago

serve-content v0.3.19

Weekly downloads
20
License
MIT
Repository
github
Last release
12 months ago

serve-content

serve-content based on file name extensions and serving jade and stylus files

extending npm-version downloads linux windows

language: English also available in: Spanish

based on serve-static

All in serve-static documentation is working here. But serve-content add some mandatory parameters to indicate which are the allowed extensions:

allowedExts

allowedExts is a white list of extensions names for serve.

allowAllExts

allowAllExts is a boolean. True means that all extensions are allowed. It can be used with excludeExts.

excludeExts

allowedExts is a black list with ignorings extensions.

example

var connect = require('connect')
var extensionServeStatic = require('serve-content')

var app = connect()

// Serve up all folders for images
app.use(serveContent('/', {
    extensions: ['html', 'htm'],
    index: 'index.html',
    allowedExts: ['', 'html', 'htm', 'png', 'jpg', 'jpeg', 'gif']
})

// Listen
app.listen(3000)

default extensions

For use the serve-static extensions parameter you must include de empty string ('') in the staticExtension list (as you see in the example).

mime types

serve-content also search the extension in the mime types. If you need to add a non standard extension you can add it in the mime field

var connect = require('connect')
var extensionServeStatic = require('serve-content')

var mime = extensionServeStatic.mime;

mime.types.specialimage = 'image/special';

var app = connect()

// Serve up all folders for images
app.use(serveContent('/', {
    extensions: ['html', 'htm'],
    index: 'index.html',
    allowedExts: ['', 'html', 'htm', 'png', 'jpg', 'jpeg', 'gif', 'specialimage']
})

// Listen
app.listen(3000)

License

MIT

0.3.19

12 months ago

0.3.18

1 year ago

0.3.17

2 years ago

0.3.16

3 years ago

0.3.15

3 years ago

0.3.14

3 years ago

0.3.13

4 years ago

0.3.12

5 years ago

0.3.11

5 years ago

0.3.10

6 years ago

0.3.9

6 years ago

0.3.8

7 years ago

0.3.7

7 years ago

0.3.5

7 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.0.1

7 years ago