Commit dc30adba authored by Geovanny Vera's avatar Geovanny Vera

Keyboard done

parent 9a8bfd82
...@@ -2,6 +2,7 @@ const Koa = require('koa'); ...@@ -2,6 +2,7 @@ const Koa = require('koa');
const Router = require("@koa/router"); const Router = require("@koa/router");
const bodyParser = require('koa-body'); const bodyParser = require('koa-body');
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const publicIp = require('public-ip');
async function main(){ async function main(){
...@@ -16,7 +17,17 @@ async function main(){ ...@@ -16,7 +17,17 @@ async function main(){
app.use(router.routes()).use(router.allowedMethods()); app.use(router.routes()).use(router.allowedMethods());
const response = await fetch('https://api.ev3.me/instances/add-world-server'); const ip = await publicIp.v4();
const response = await fetch('https://api.ev3.me/instances/add-world-server', {
headers: {
'X-Orig-IP': ip
}
});
if(!response.ok){
console.error('Couldn\'t connect to API');
return;
}
// const data = await response.json(); // const data = await response.json();
// console.log(data); // console.log(data);
......
This diff is collapsed.
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"@koa/router": "^8.0.8", "@koa/router": "^8.0.8",
"koa": "^2.11.0", "koa": "^2.11.0",
"koa-body": "^4.1.1", "koa-body": "^4.1.1",
"node-fetch": "^2.6.1" "node-fetch": "^2.6.1",
"public-ip": "^4.0.3"
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment