Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 27 additions & 16 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
// Import the 'http' and 'fs' modules
var http = require("http")
var fs = require("fs")


// Create an HTTP server
var server = http.createServer(function (req,res){
console.log("hi boss", req.url)
console.log("hi boss", req.url) // Log the incoming request URL

if(req.url === "/me" || "/"){
res.writeHead(200,{"content-Type":'text/html'})
// Check the requested URL and handle accordingly
if(req.url === "/me" || req.url === "/"){
// If the URL is '/me' or '/' serve 'me.html'
res.writeHead(200, {"content-Type":'text/html'});
fs.createReadStream(__dirname + "/me.html").pipe(res)
}
if(req.url === "/social" || "/"){
res.writeHead(200,{"contnt-Type":'text/html'})
fs.createReadStream(__dirname + "/social.html").pipe(res)
}
if(req.url === "/span" || "/"){
res.writeHead(200,{"content-Type": 'text/html'})
fs.createReadStream(__dirname + '/span.html').pipe(res)
}else if(req.url === "/social" || req.url === "/"){
// If the URL is '/social', serve 'social.html
res.writeHead(200, {"contnt-Type":'text/html'});
fs.createReadStream(__dirname + "/social.html").pipe(res);
}else if(req.url === "/span" || req.url === "/"){
// If the URL is '/span', serve 'span.html
res.writeHead(200,{"content-Type": 'text/html'});
fs.createReadStream(__dirname + '/span.html').pipe(res);
}else {
// If the URL doesn't match any of the above, serve '404.html'
res.writeHead(404, {"content-Type": 'text/html'});
fs.createReadStream(__dirname + '/404.html').pipe(res);
}

})
});

// Set the server to listen on a specified port (default is 8080)
var PORT = process.env.PORT || 8080
server.listen(PORT, function(){
return console.log(`listening on PORT ${PORT}`)
})
console.log("Creative developer")
return console.log(`Listening on PORT ${PORT}`);
});

// Log a message to the console
console.log("Creative developer");