1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | var http = require("http"); //callback function, kode ini dieksekusi pas ada request function onRequest(request, response) { console.log("A request from user...."+request.url); response.writeHead(200,{"Context-Type": "text/plain"}); response.write("Hellow disana....Terima kasih sudah akses server ini... :D"); response.end(); } //Start server and listen to port 8888 http.createServer(onRequest).listen(8888); console.log("Server running...."); |
Terus kita start servernya pake cmd...
Hasilnya dibuka pake browser....
No comments:
Post a Comment