Токен в .env и новый стиль

This commit is contained in:
2020-08-31 16:07:50 +03:00
parent ff1d8db3e0
commit 589493ae69
3 changed files with 29 additions and 6 deletions

View File

@@ -8,16 +8,18 @@ import { httpsReq } from "./httpsReq.js";
dotenv.config();
const app = Express();
const port = process.env.PORT || 5001;
const port = process.env.PORT || 5000;
const statusIds = [1, 2, 3, 4, 5, 9, 10, 17, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 38, 39];
app.use(Cors());
app.get('/update', (req, res) => {
let id = Math.floor(Math.random() * 34);
let url = `https://api.vk.com/method/users.setCovidStatus?access_token=1f3a7a0c80ba9d1e4af5b3e9ac583c98aa6d036be89c2508f4486913b1cbdb125a9a8c4440b6dbb57f348&status_id=${id}&v=5.103`;
var id = statusIds[Math.floor(Math.random() * statusIds.length)];
let url = `https://api.vk.com/method/users.setCovidStatus?access_token=${process.env.TOKEN}&status_id=${id}&v=5.103`;
httpsReq(url).then(() => {
res.send();
console.log(response);
res.redirect("https://status.anatolykopyl.ru");
});
});