简体   繁体   English

如何发布我的第一个Node.js应用程序?

[英]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. 您会在这里找到一个很好的教程来部署您的第一个实例,它将节省您几个小时的研究时间。

Tutorial 教程

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.

相关问题 如何将node.js应用程序部署到服务器? - How do I deploy my node.js app to a server? 如何将node.js Web应用程序上传到openshift? 它不是在git上,而是在我的计算机上? - How do I upload my node.js web app to openshift? It is NOT on git, but just on my computer? 如何将我的 node.js api 发布到 iis? - How can I publish my node.js a.p.i to iis? 如何将我的Heroku配置变量链接到Node.js应用程序 - How do I link my Heroku Config Variables to a Node.js app 如何将具有opencv4nodejs依赖项的Node.js应用程序部署到Heroku? - How do I deploy my Node.js app with a opencv4nodejs dependency to Heroku? 如何在我的简单Express应用程序中使用Node.js群集? - How do I use Node.js clusters with my simple Express app? 如何将我的 Typescript Node.js 应用程序部署到 Heroku? - How do I deploy my Typescript Node.js app to Heroku? 如何让我的 Node.js 应用程序集群化以仅运行一次任务? - How do I get my Node.js app which is clustered to run a task only once? 如何仅在node.js heroku应用程序上授予对我的网站的访问权限 - How do i grant access to my site only on a node.js heroku app 如何将node.js webhook链接到我的Facebook应用程序的messenger API? - How do I link a node.js webhook to the messenger API of my Facebook app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM