npm

Does your artifact manager get in the way? Join us on Oct. 8 at 10am PT, to discuss how npm can help.Sign up »

@hapi/subtext

6.1.2 • Public • Published

subtext

HTTP payload parser.

Build Status

subtext parses the request body and returns it in a promise.

Example

const Http = require('http');
const Subtext = require('@hapi/subtext');
 
Http.createServer(async (request, response) => {
 
  const { payload, mime } = await Subtext.parse(request, null, { parse: true, output: 'data' });
 
  response.writeHead(200, { 'Content-Type': 'text/plain' });
  response.end(`Payload contains: ${JSON.stringify(payload)}`);
 
}).listen(1337, '127.0.0.1');
 
console.log('Server running at http://127.0.0.1:1337/');
 

API

See the API Reference

install

npm i @hapi/subtext

Downloadsweekly downloads

107,447

version

6.1.2

license

BSD-3-Clause

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability