admin管理员组

文章数量:1305232

I have searched everywhere for a solution to this problem but for whatever reason I cannot find a clear answer as to how I can carry out this task.

I have built a very simple server with node.js that accesses two numbers from a website API and outputs them onto a localhost port on my puter as shown below:

My question is how can I take my server and make it accessible to applications without having to go into the mand line and run the server file? Is there a way I can host it online instead of locally so that I can distribute the application and anyone with the application can pull from this server? What would be the best way to go about acplishing this task?

I have searched everywhere for a solution to this problem but for whatever reason I cannot find a clear answer as to how I can carry out this task.

I have built a very simple server with node.js that accesses two numbers from a website API and outputs them onto a localhost port on my puter as shown below:

My question is how can I take my server and make it accessible to applications without having to go into the mand line and run the server file? Is there a way I can host it online instead of locally so that I can distribute the application and anyone with the application can pull from this server? What would be the best way to go about acplishing this task?

Share Improve this question edited Jun 10, 2016 at 18:01 Roger99 asked Sep 23, 2015 at 0:13 Roger99Roger99 1,0022 gold badges13 silver badges43 bronze badges 2
  • 1 You either buy a static IP address for your home internet connection and then punch a hole in your home firewall (not remended) and access it via an IP address or you find a hosting site that supports node.js apps and you pay them to host your server and probably buy a domain that you can hook up to your IP address. FYI, you will probably want to fix your onRequest() handler so it only runs on a certain URL such as /getStatus so you can add other URLs in the future and so if a browser hits your server, your request handler doesn't run when the browser is just trying to get the icon. – jfriend00 Commented Sep 23, 2015 at 0:19
  • you can get a vm from digital ocean for 5 bucks a month, and for even less from less-reputable places, down to $20/year – dandavis Commented Sep 23, 2015 at 0:25
Add a ment  | 

4 Answers 4

Reset to default 2

Heroku is probably one of the easiest ways to get started with deploying the application: https://devcenter.heroku./articles/getting-started-with-nodejs#introduction

However, if you are not familiar with git, Microsoft Azure Webapps is also another great option: https://tryappservice.azure./

They both offer free plans which should get you up and running fast!

I have implemented that with Amazon AWS, they offer free option for a limited time, but still great because you have full control on the console, you should be careful while installing the machine on cloud, you have many guides online that you can follow for steps, this one for example has step by step info, try to follow the steps and you will be able to run your app and access it from any public network.

Question 1: how can I take my server and make it accessible to applications without having to go into the mand line and run the server file?

To start a node server you will always need to use the console. If you are not used to,it's time to start :) . You will be using it not only for node servers but for administrating (almost) every server in the world.

Question 2: Is there a way I can host it online instead of locally ?

There are a lot of nodejs hosting platforms, you can choose between PaaS solutions or IaaS solutions ( AWS EC2, Digital Ocean, etc.) . Probability the easiest way to start ar PaaS services, in this blogbost you will find a good list of PaaS hosting providers. Some of them have free plans.

Take a look at Heroku. They have a free tier (with limitations) and a hobby tier for $7/month.

本文标签: