-1
I’ve been dedicating myself to Javascript for some time, looking for various ways to learn, recently I came across the callback functions, usually used when using javascript on a server instead of local (correct me if I’m wrong).
I found a series of exercises to learn how to simulate a server with Ode, downloaded all the files and now I intend to start programming on it. However the exercises I am following to learn step by step, it is not clear to me yet, follow what is suggested:
What he means in "the server must respond to /file/*
URI? And then map to a Folder location. I can’t understand what I should do to start working with this. If someone could give a clearer explanation, so that a beginner could understand and develop something, or even a generic code as an example, it would also be very productive to the studies. Thank you very much.
All I’ve done so far is:
var http = require('http');
function onrequest(request, response) {
response.writeHead(200);
response.end("Hello World\n");
}
var server = http.createServer(onrequest);
server.listen(8000);
console.log("Listening on http://127.0.0.1:8000/");
Here’s an example that can help https://adrianmejia.com/building-a-node-js-static-file-server-files-over-http-using-es6/
– Bins
Excellent for Nodejs beginners: https://www.youtube.com/playlist?list=PLJ_KhUnlXUPtbtLwaxxUxHqvcNQndmI4B
– LeAndrade