Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const micro = require('micro');
- const query = require('micro-urlencoded');
- module.exports = (...args) => handler => micro((req, res) => {
- if(req.method === 'POST') {
- return query(req).then(
- ({body}) => handler(body, req, res)
- );
- }
- res.setHeader('content-type', 'text/html');
- return String.raw(...args);
- });
Add Comment
Please, Sign In to add comment