javascript - Node: css,images not working fine upon loading php script -
Hi, Tried some tutorials on running PHP on the node from this site, so I was able to load the page but the problem is that some images did not load and why CSS rules are not running any ideas?
requires http = ("http"), path = is required ("path"), url = require ( "Url"), fs = is required ("fs"); Function sendError (errCode, errString, response) {response.writeHead (errCode, {"content-type": "text / plain"}); Response.write (errString + "\ n"); Response.end (); Return; } SendFile function (error, file, response) {If (mistake) send return air (500, mistake, response); Response.writeHead (200); reaction. Write (file, "binary"); Response.end (); } Function getFile (exists, response, locate) {If (! Is present) send back arrowroof (404, '404 not found', response); Fs.readFile (localpath, "binary", function (error, file) {sendFile (error, file, response);}); } GetFilename function (request, response) {var urlpath = url.parse (request.url) .pathname; // The following domain or IP and port var localpath = path.join (process.cwd (), urlpath); // if we are on the root path Axis (localethheth, function (result) {getFile (result, response, localitance)}); } Var Server = http.createServer (getFilename); Server.listen (1000); Console.log ("The server is available ...");
I have also ensured that all the files are present, please thank you!