We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 75d6a27 commit 0261b8dCopy full SHA for 0261b8d
1 file changed
index.ts
@@ -5,13 +5,23 @@ import bot, { registerCommands } from './services/bot';
5
dotenv.config();
6
7
const app = express();
8
-app.use(express.json());
+app.use(express.json({
9
+ limit: '1mb',
10
+ verify: (req, res: express.Response, buf) => {
11
+ try {
12
+ JSON.parse(buf.toString());
13
+ } catch (e) {
14
+ res.status(400).send('Invalid JSON');
15
+ throw new Error('Invalid JSON');
16
+ }
17
18
+}));
19
const PORT = process.env.PORT || 3000;
20
21
registerCommands();
22
23
app.post('/', (req, res) => {
- console.log("Received update:", req.body);
24
+ console.log("Received update:", JSON.stringify(req.body).substring(0, 200) + "...");
25
try{
26
bot.processUpdate(req.body);
27
res.status(200).send('OK');
0 commit comments