mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-22 18:07:16 +00:00
example: update express example
bodyParser is built-in again. (#791) See: https://stackoverflow.com/questions/47232187/express-json-vs-bodyparser-json/47232318
This commit is contained in:
parent
5169d79bd9
commit
8bf57c1275
@ -10,7 +10,6 @@ const port = process.env.PORT;
|
|||||||
|
|
||||||
const TelegramBot = require('../..');
|
const TelegramBot = require('../..');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const bodyParser = require('body-parser');
|
|
||||||
|
|
||||||
// No need to pass any parameters as we will handle the updates with Express
|
// No need to pass any parameters as we will handle the updates with Express
|
||||||
const bot = new TelegramBot(TOKEN);
|
const bot = new TelegramBot(TOKEN);
|
||||||
@ -21,7 +20,7 @@ bot.setWebHook(`${url}/bot${TOKEN}`);
|
|||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
// parse the updates to JSON
|
// parse the updates to JSON
|
||||||
app.use(bodyParser.json());
|
app.use(express.json());
|
||||||
|
|
||||||
// We are receiving updates at the route below!
|
// We are receiving updates at the route below!
|
||||||
app.post(`/bot${TOKEN}`, (req, res) => {
|
app.post(`/bot${TOKEN}`, (req, res) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user