This commit is contained in:
7
index.js
7
index.js
@@ -5,6 +5,13 @@ const { port, command } = require('./config');
|
||||
const express = require('express')
|
||||
const app = express()
|
||||
|
||||
app.use((req, res, next) => {
|
||||
res.header('Access-Control-Allow-Origin', '*');
|
||||
res.header('Access-Control-Allow-Methods', 'GET, POST');
|
||||
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With');
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/ip', async (req, res) => {
|
||||
let output = execSync(command, { encoding: "utf8" });
|
||||
res.json(await ip.parseNetworkInfo(output))
|
||||
|
||||
Reference in New Issue
Block a user