简体   繁体   中英

NodeJS from localhost to online site

I have a site that I created using NodeJS and one page html/jquery everything is working as expected on the localhost provided but I'm getting some issue in putting that site online www.xxxx.com , I already got a .com domain but I don't know which configuration should I do on my site and on code, which mean is there steps to follow on the app.js which contain the localhost:3500 ?

This is the structure of my folder developped under VSCODE

我的文件夹的结构

and this is my statement app.js of the localhost

//start the server.
app.listen(3500, function () {
 console.log('Example app listening on port 3500!');
});

Hope I mentioned everything Best Regards

To host a website you don't' just need the domain name (.com) but you need the server and hosting as well.

Here you can find details:

If you're like me who doesn't want to get into the configuration details of the host server, check out heroku . It's a platform-as-a-service that allows you to host a site really easily and it has a pretty generous free-tier. Not much will have to change code-wise maybe just making the port a variable.

One major issue I had with the platform is that you cannot save files on the filesystem using code, you'll have to use an external file storage like AWS.

The other, slightly minor issue is that you need to be using git to push your code to the heroku servers (Not really an issue tbh since you really should look into git if you aren't using it already)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM