express
this code is working fine on my local machine but not working on railway why ?
require("dotenv").config();
const bodyParser = require("body-parser");
const TelegramBot = require("node-telegram-bot-api");
const token = process.env.TELEGRAM_TOKEN;
const bot = new TelegramBot(token, { polling: false });
const express = require("express");
const app = express();
app.use(bodyParser.json());
app.post("/alert", function (req, res) {
const { action, value, name } = req.body;
bot.sendMessage(
process.env.TELEGRAM_CHAT_ID,
Alert: \nname :- ${name}\naction :- ${action}\nvalue :- ${value}
);
res.send(req.body);
});
app.get("/", function (req, res) {
res.send("Hello World");
});
app.listen(80);
console.log("Server running at http://localhost:80/");3 Replies
Project ID:
N/A
N/A