@aeinbu/bodyparser

Utility to parse the body of an http request.

Usage no npm install needed!

<script type="module">
  import aeinbuBodyparser from 'https://cdn.skypack.dev/@aeinbu/bodyparser';
</script>

README

bodyparser

A very simple http request body parser. (That won't fail on invalid request-encoding header...)

How to use with express web server

const bodyparser = require("@aeinbu/bodyparser");

// set up express
// ...

app.post("somepage",
    bodyparser.raw(),
    function(req, resp){
        // The raw body data is avaliable as req.body
        // ...
    });

app.post("otherpage",
    bodyparser.json(),
    function(req, resp){
        // The body json data is avaliable as req.body
        // ...
    });