-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
32 lines (27 loc) · 878 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const express = require('express');
const path = require('path');
const fs = require("fs");
const bodyParser = require('body-parser');
const { default: fetch } = require('node-fetch');
/* Express functions */
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(express.static('./'));
app.use(express.json());
app.get('/', (req, res) => {
res.setHeader('Content-type', 'text/html');
res.sendFile('./index.html')
})
app.get('/getUser/:user', (req,res) => {
const userToken = req.params.user;
fetch(`https://login.ivao.aero/api.php?type=json&token=${userToken}`)
.then(data => data.json())
.then(data => {
if(data.vid != null){
res.send(data)
}
});
})
const port = process.env.port || 80;
app.listen(port, () => console.log(`Escuchando en el puerto ${port}...`));