From 667e665900e6005a939a3bc41e9d2ffaa738d044 Mon Sep 17 00:00:00 2001 From: da kong Date: Mon, 29 Nov 2021 12:46:00 +0800 Subject: [PATCH] Moved express receiver decoder to code --- README.md | 2 -- src/index.ts | 9 +++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a58330c..9f6f52a 100644 --- a/README.md +++ b/README.md @@ -76,8 +76,6 @@ const botConfig = { let app = express() const skills = [] app = extendApp(app, skills, eventHandler, botConfig) -app.use(express.json()); -app.use(express.urlencoded({extended: true})); app.listen(3000, () => { console.log('server running') }) diff --git a/src/index.ts b/src/index.ts index ee36f4a..a38d2fc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,9 @@ import botApp from './apps/bot'; import adminApp from './apps/admin'; -import { BotConfig } from './types' -import defaultModels from './models' +import { BotConfig } from './types'; +import defaultModels from './models'; +import express from 'express'; export const extendApp = ( app: any, @@ -35,6 +36,10 @@ export const extendApp = ( } } }; + + app.use(express.json()); + app.use(express.urlencoded({extended: true})); + app.use( config.adminRoute, adminApp(mergedHandle, conf)