i am trying to make a server which listens to simple requests and answers with data,
my project is pretty large so i am gonna make it simple,
this is my index.js code here
http =require('http');
fs =require('fs');
//404
function send404(res){
res.writeHead(404,{'Context-Type':'text/plain'});
res.write('error 404 page not found');
res.end();
}
function onRequest(req,res){
res.writeHead(200,{'Context-Type':'text/plain'});
fs.createReadStream('./index.html').pipe(res);
}
http.createServer(onRequest).listen(80);
what i want is to connect to this server normally and STATICALLY
which means that this servers ip must be constant so the users of my (in future) android app will be able to access it always
the server is gonna run on a simple laptop always
and users can use the server from the app at any time and any device (using the mobile app)
so the process must be as simple as it is
i had so many suggestions to use the port 80
but that does not resolve the issue since the user must always know my ip
(although that’s not secure at all)