Skip to content

Commit 0261b8d

Browse files
committed
index
1 parent 75d6a27 commit 0261b8d

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

index.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@ import bot, { registerCommands } from './services/bot';
55
dotenv.config();
66

77
const app = express();
8-
app.use(express.json());
8+
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+
}));
919
const PORT = process.env.PORT || 3000;
1020

1121
registerCommands();
1222

1323
app.post('/', (req, res) => {
14-
console.log("Received update:", req.body);
24+
console.log("Received update:", JSON.stringify(req.body).substring(0, 200) + "...");
1525
try{
1626
bot.processUpdate(req.body);
1727
res.status(200).send('OK');

0 commit comments

Comments
 (0)