Check out example codes for "why is my discord bot keep going offline". It will help you in understanding the concepts better.

Code Example 1

require("http").createServer(async (req,res) => { res.statusCode = 200; res.write("ok"); res.end(); }).listen(3000, () => console.log("Now listening on port 3000"));

Learn ReactJs, React Native from akashmittal.com