Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "mimeware", | ||
"description": "Cross-framework HTTP middleware to infer the proper MIME content type response header", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": "h2non/mimeware", |
@@ -1,2 +0,2 @@ | ||
# mimeware [][travis] [][gemnasium] [][npm] | ||
# mimeware [][travis] [][gemnasium] [][npm] | ||
@@ -15,3 +15,3 @@ Node.js HTTP server middleware to infer and define the proper MIME content type as response header | ||
```bash | ||
npm install mimewire --save | ||
npm install mimeware --save | ||
``` | ||
@@ -23,10 +23,21 @@ | ||
var express = require('express') | ||
var mimewire = require('mimewire') | ||
var mimeware = require('mimeware') | ||
var app = express() | ||
app.use(mimewire({ defaultType: 'text/html' })) | ||
app.use(mimeware({ defaultType: 'text/html' })) | ||
app.get('/hello', function (req, res, next) { | ||
// respond with default type: text/html | ||
res.send('Hello World!') | ||
}) | ||
app.get('/hello.json', function (req, res, next) { | ||
// respond with type: application/json | ||
res.json({ say: 'Hello World!' }) | ||
}) | ||
app.get('/hello.xml', function (req, res, next) { | ||
// respond with type: text/xml | ||
res.send('<say>Hello World!</say>') | ||
}) | ||
``` | ||
@@ -33,0 +44,0 @@ |
7175
67