/* * @Author: your name * @Date: 2021-06-16 06:38:54 * @LastEditTime: 2021-06-16 17:19:23 * @LastEditors: your name * @Description: In User Settings Edit * @FilePath: /hapi-demo/source/route/index/index.ts */ import { config, method } from "@noderun/hapi-router"; import UploadFunc from "./_upload"; export default class { index(request, h) { return h.view("views/index.ejs"); } about(request, h) { return h.view("views/about.ejs"); } @config({ payload: { maxBytes: 20000 * 1024 * 1024, output: "stream", parse: false, allow: "multipart/form-data", }, }) @method("POST") async upload(req, h) { const startTime = new Date().getTime(); const res = await UploadFunc(req, h); const endTime = new Date().getTime(); console.log( `该请求处理时间为:${Number(endTime - startTime).toFixed(2)}ms` ); return res; } }