[英]How do I publish my first Node.js app?
I've built a website which I'm serving through a basic Node.js server that I've built as well. 我已经建立了一个网站,并通过我已经建立的基本Node.js服务器提供服务。
I've created a mysitename folder which itself contains a public folder (containing all the .html, .css etc. files) as well as a server.js file (my server). 我创建它本身包含公用文件夹 (包含所有的.html,等的CSS文件),以及一个server.js文件(我的服务器)一mysitename文件夹。 I call node server.js from inside mysitename folder and everything is working fine on localhost:8080
我从mysitename文件夹中调用了节点server.js,并且在localhost:8080
上一切正常
Now I want to publish it (in a dev environment, ie the URL would look something like this : http://mysitename.someservice.com ) so that I can test it live. 现在,我要发布它(在开发环境中,即URL看起来像这样: http : //mysitename.someservice.com ),以便可以对其进行实时测试。
I tried heroku .com but they couldn't have made the process of setting up my app to serve through them more confusing. 我尝试了heroku .com,但他们无法使设置我的应用程序以通过它们提供服务的过程更加混乱。 It's so confusing it's ridiculous. 它是如此混乱这是荒谬的。
I thought that it was just a matter of uploading this mysitename folder online and then using some service to execute server.js 我认为这只是在线上传此mysitename文件夹,然后使用某些服务执行server.js的问题
Is there a simpler , more " out-of-the-box " free service I could use and definitely less of the maze heroku appears to be, or is there a better step-by-step guide , at least, on how to do that using Heroku ? 有没有我可以使用的更简单 ,更“ 开箱即用 ”的免费服务,而迷宫heroku似乎绝对更少,或者至少在如何操作方面有更好的分步指南那使用Heroku吗?
I followed the steps on the Heroku site, created a BitBucket Account and a repo with the folder I mentioned above and then I installed Source Tree but by the time I got to the last step nothing was working. 我按照Heroku网站上的步骤进行操作,使用上面提到的文件夹创建了一个BitBucket帐户和一个存储库,然后安装了Source Tree,但是到最后一步时,我什么都没用。 I know I'm mentioning Heroku but I'd rather stay away from that riddle if there's a cleaner way of doing things. 我知道我提到的是Heroku,但如果有一种更清洁的方法,我宁愿远离这个谜语。
This is the first time I try to publish a site (let alone a site being served through my own server) so I would really appreciate the help as I'm completely in the dark right now. 这是我第一次尝试发布网站(更不用说通过我自己的服务器为网站提供服务了),因此我非常感谢您的帮助,因为我现在完全处于黑暗之中。
If this is not the forum for such a question please let me know and I'll remove it and then search elsewhere. 如果这不是这个问题的论坛,请告诉我,我将其删除,然后在其他地方搜索。
Thank you once again for your help! 再次感谢您的帮助!
I would suggest that you roll your own server , you'll have a lot more control and flexibility to experiment/make mistakes. 我建议您滚动自己的服务器 ,以拥有更多的控制权和灵活性来尝试/犯错。
As you seem to be a beginner, you'll be able to learn at your own pace without being limited by the platform you're using. 由于您似乎是个初学者,因此您可以按照自己的节奏进行学习,而不受使用的平台的限制。 For example, Heroku's read-only filesystem, PostgreSQL database, etc... 例如,Heroku的只读文件系统,PostgreSQL数据库等。
What I'd suggest is to use Amazon EC2. 我建议使用Amazon EC2。 The reason is simple, they give you a free instance for a year, it's like having a free PC in the cloud for you to play with. 原因很简单,它们为您提供了一年的免费实例,就像在云中拥有一台免费的PC供您玩耍一样。 (No I'm not affiliated to amazon, just remembering the joy I experienced when I was just started and found that out). (不,我不隶属于亚马逊,只是想起了刚开始时发现的快乐)。
You'll find a great tutorial here to deploy your first instance, it'll save you a few hours of research time. 您会在这里找到一个很好的教程来部署您的第一个实例,它将节省您几个小时的研究时间。
Once your server is setup, grab a cheap domain name from godaddy or namecheap, and point it to your server's IP. 设置好服务器后,请从godaddy或namecheap中获取便宜的域名,然后将其指向服务器的IP。 Your site will be up and running in no time, for about 3$ total. 您的网站很快就会启动并运行,总计约3 $。
The whole process is very easy to do, and will give you far more knowledge than using one or the other online solutions. 整个过程非常容易完成,与使用一个或另一个在线解决方案相比,它将为您提供更多的知识。 As a bonus, you will be able to run all sorts of things on your instance, while keeping your website alive. 作为奖励,您将能够在您的实例上运行各种操作,同时保持网站正常运行。
And for all your problems, there is Stack Overflow. 对于您所有的问题,都有堆栈溢出。
Happy Coding! 编码愉快!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.