express-json

A middleware for Express that sets Content-Type to text/plain if Accept header doesn't contain application/json.

Usage no npm install needed!

<script type="module">
  import expressJson from 'https://cdn.skypack.dev/express-json';
</script>

README

express-json

A middleware for Express that sets Content-Type to text/plain if Accept header doesn't contain application/json.

Installation

$ npm install express-json

Usage

var express = require('express'),
    json = require('express-json');

var app = express()
  .use(json())
  .use(function (req, res) {
    res.json({
        helloWorld: 'Hello World!'
    });
  })
  .listen(3000);