html page not loading when running javascript server

So I’m creating a game with HTML, css, and javascript, and I’m trying to incorporate template engines/ajax in this task. I made a server which if I run in cmd and then open up google chrome and type ‘localhost:3000’ in the address line, it is supposed to direct me to the main.html page.

However, when I type ‘node server.js’ in cmd, it runs properly but when I enter ‘localhost:3000’ in the browser it says the page does not exist. I’m not sure what went wrong. If I were to manually double click on the html file in my folder, it works, but I’m trying to get it to load by running a server.

I have three folders (img, node_modules, and pages) and 2 json packages which were created by installing express and pug. It’s hard to explain my folder paths and code here, so I have a link to a folder containing my files/sub folders and it also gives a clearer view of the path in my directory: https://github.com/jessaisreal/game

It wouldn’t let me upload the node_modules folder as it was too big, but I automatically got it from typing ‘npm init’, ‘npm install express’ and ‘npm install pug’ into the cmd line in the folder.

I’m assuming something is wrong with my server.js file or the way my folders are set up. I’m really desperate to get my program working and would appreciate any help. I have no idea why my html page isn’t loading. I’m also not sure if I handled the GET request for getting specific fonts correctly.

I cut down my program as much as I could. There are several html and css files, but only included create and main here for simplicity. Again, I would appreciate any help or a push in the right direction!!

server.js:

	const http = require('http');
	const fs = require("fs");
	const pug = require("pug");

	//user pug functrion to render through the create Page
	const renderMain = pug.compileFile('pages/main.pug');
	const renderCreate = pug.compileFile('pages/create.pug');


	//Helper function to send a 404 error
	function send404(response){
		response.statusCode = 404;
		response.write("Unknown resource.");
		response.end();
	}

	// Helper function to send 500 server error;
	function send500(response){
		response.statusCode = 500;
		response.write("Server error.");
		response.end();
	}


	// initilize the server
	const server = http.createServer(function (request, response) {
		//console.log(request.method+" -> "+request.url);  test about the income request

		// handle the get request
		if(request.method === "GET"){
			if(request.url === "/" || request.url === "/main"){
				let data = renderHome("./pages/main.pug",{})
				response.statusCode = 200;
				response.end(data);

			}else if(request.url === "/main.js"){
				//read main.js file and send it back
				fs.readFile("main.js", function(err, data){
				if(err){
					send500(response);
					return;
				}
				response.statusCode = 200;
				response.setHeader("Content-Type", "application/javascript");
				response.write(data);
				response.end();
				});
			}else if(request.url === "/main.css"){

				//read css file
				fs.readFile("main.css", function(err, data){
				if(err){
					send500(response);
					return;
				}
				response.statusCode = 200;
				response.setHeader("Content-Type", "text/css");
				response.write(data);
				response.end();
				});			
			}else if(request.url === "/create"){
				let data = renderLogin("./pages/create.pug",{})
				response.statusCode = 200;
				response.end(data);
				
			}else if(request.url === "/create.js"){
				//read create.js file and send it back
				fs.readFile("create.js", function(err, data){
				if(err){
					send500(response);
					return;
				}
				response.statusCode = 200;
				response.setHeader("Content-Type", "application/javascript");
				response.write(data);
				response.end();
				});
			}else if(request.url === "/create.css"){

				//read css file
				fs.readFile("create.css", function(err, data){
				if(err){
					send500(response);
					return;
				}
				response.statusCode = 200;
				response.setHeader("Content-Type", "text/css");
				response.write(data);
				response.end();
				});		
			}else if(request.url === "/img/sky1.gif"){

				fs.readFile("img/sky1.gif", function(err, data){
				if(err){
					send500(response);
					return;
				}
				response.statusCode = 200;
				response.setHeader("Content-Type", "image/gif");
				response.write(data);
				response.end();
				});
			}else if(request.url === "/Pixellari.tff"){

				fs.readFile("img/Pixellari.tff", function(err, data){
				if(err){
					send500(response);
					return;
				}
				response.statusCode = 200;
				response.setHeader("Content-Type", "font/tff");
				response.write(data);
				response.end();
				});
			}else{
				send404(response);
				return;
			}
		}
	});

	//Server listens on port 3000
	server.listen(3000);
	console.log('Server running at http://127.0.0.1:3000/');