I’ve almost finished a functioning chat client that I wrote with node, express, and MongoDB, I’d like to implement it to my website as one of the web pages but I’m little confused how the server I wrote is supposed work when there’s a company hosting my website. Do I just place my “server.js” file inside of my public_html folder in the admin area like a regular web page?
Hopefully, my question is clear I’m finding it difficult to explain.
No, “public” is only for static, client-side files.
Exactly how to set up depends partly on what hosting solution you’re using. The simplest option is something like Glitch, where you can basically just dump your files, configure your
package.json, and you’re good to go. They have a few boilerplate options if you want to see how a typical app is laid out.
Hm glitch seems pretty cool, I’ll mess around with that. That should work just fine for what I’m trying to do.
For my own personal knowledge though, how would I implement something like a chat application without a third party, I’m using host gator.
I’m not familiar with gator host. If you mean HostGator, it looks like you’d start from this: https://support.hostgator.com/articles/specialized-help/technical/node-js (but it mentions it’s only available on certain packages).
Once you have a server up and running with Node.js on it, you can start it the same way you usually would, i.e.
node <file path> or
npm start with a
start script specified in
package.json. You may also need to configure ports (usually 80 for HTTP and 443 for HTTPS).
I edited it was a typo. Great just the info I need, thank you.