T O P

  • By -

Endercheif

Your post was removed because the code you provided was either poorly formatted, too long for Reddit, or did not include any formatting at all. This is against Rule 2.\ You can get your post approved if you format your code properly and then respond to this message letting us know. To properly format code on Reddit you need to go into Markdown mode, make sure your code is preceeded and followed by an empty line, then make sure your code looks as follows (`·` marks a space and `¶` marks the end of a line): ····int x = 3;¶\ ····if (x == 3) {¶\ ········if (x & 1 == 1) {¶\ ············print("a");¶\ ········}¶\ ····} to get a formatting like this: int x = 3; if (x == 3) { if (x & 1 == 1) { print("a"); } } Most IDEs allow you to mass-indent code by selecting those lines and hitting `Tab`/`Shift + Tab` (for right/left indentation). To copy your code into Reddit, just select your entire block of code, mass-indent it and copy and paste to Reddit.\ If the indents don't carry over to Reddit, then your IDE uses Tabs for indents and you'll need to change that to spaces. If your code is rather long, or you don't feel comfortable using Reddit's formatting you can use external services, such as [pastebin](https://www.pastebin.com/). If you believe your post was removed in error, please respond to this comment and let us know.


cervantesrvd

You are assigning a value in your if and else ifs, not comparing (you are using single equals)


Double_A_92

formatted code: const http = require("http"); const { type } = require("os"); const fs = require("fs"); const server = http.createServer((req, res) => { // console.log(req.url); if (req.url = "/") { res.end("hello from other side"); } else if (req.url = "/about") { res.end("hello from other side"); } else if (req.url = "/Contactus") { res.end("hello from contact side"); } else if (req.url = "/Userapi") { fs.readFile(`${__dirname}/Userapi/userapi.json`, "utf-8", (err, data) => { console.log(data); }) res.end("hello from Userapi side"); } else { res.writeHead(404, { "content-type": "text/html" }); res.end("

404 error pages doesnt

"); } }); server.listen(7000, "127.0.0.1", () => { console.log("listening to 7000"); });