@serverless-devs/http-response-parser

0.0.4-alpha.38 • Public • Published

http-response-parser 转化

  • html: content-typetext/html; charset=utf8
  • css: content-typetext/css; charset=utf8
  • js: content-typetext/javascript; charset=utf8
  • text: content-typetext/plain; charset=utf8
  • json: content-typeapplication/json; charset=utf8
  • xml: content-typeapplication/xml; charset=utf8

基本用法

'use strict';
const dk = require('@serverless-devs/dk-core');
const httpResponseParser = require('@serverless-devs/http-response-parser');

const handler = dkrequest) => {
  return {
    html: `<!DOCTYPE html>
  <html lang="en">
  <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Document</title>
  </head>
  <body>
      text/html
  </body>
  </html>`,
  };
});

handler.use(httpResponseParser());

module.exports = { handler };

Readme

Keywords

none

Package Sidebar

Install

npm i @serverless-devs/http-response-parser

Weekly Downloads

0

Version

0.0.4-alpha.38

License

ISC

Unpacked Size

13.8 kB

Total Files

10

Last publish

Collaborators

  • serverlessfans
  • heimanba
  • xsahxl