@
@
@skppp2014-10-26 21:57:56
JavaScript
@skppp, 2014-10-26 21:57:56

How to push node to hosting?

Let's say there is a ready-made application. It runs fine through the terminal "node something there.js", but how to hang it on the hosting? After all, there are neither html nor php files, and the js file cannot be opened just like that. So I'm very interested in how to make it work on hosting.
I immediately apologize for such a question, I understand that there is most likely a lot of information on Google about this, but I searched for this for about 15 minutes, and did not find specific answers. Probably I'm not asking the right question.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
D
Denis Pushkarev, 2014-10-26
_

On shared hosting with php - no way. It is best to take an inexpensive vps. As cliche as it sounds, I would recommend DigitalOcean.

R
Roman Zhak, 2014-10-26
@romanzhak

On Centos, for example: https://www.digitalocean.com/community/tutorials/h... . Pretty much the same for the rest. In general, on the request how to install nodejs centos/ubuntu ... everything is googled.

P
Puma Thailand, 2014-10-27
@opium

Buy node hosting and not php, it's stupid to buy chocolate and be surprised that it's not meat.

I
ID25, 2014-10-26
@ID25

Put this in package.json.

"scripts": {
    "start": "server.js"
  },

In the server.js itself, use get for the site root '/' and give your html template there.
Here is an example:
app.get('/', function (req, res) {
  res.render(__dirname + '/client/views/index');
});

and set the port to listen like this
http.listen(process.env.PORT || 80);

N
Nikita Gushchin, 2014-10-27
@iNikNik

You can start the server by making a package.json similar to what is used in angular-seed :

{
    ...
    "scripts": {
        ...
        "start": "http-server -a localhost -p 8000 -c-1",
        ...
    }
    ...
}

Here is a link to the http-server package .
With this setup, you can start the server in the console with the "npm start" command. And the server itself has already been recommended to you by @zhak55 and @rock .

D
Dmitry, 2014-10-27
@kasus

Use nodejs PaaS like appfog.com

A
Alexander Kaloshin, 2014-10-28
@undassa

You can try the Last.Backend service. Using the constructor, visually create the necessary infrastructure... Everything is described in detail in the User Guide, just using the example of deploying a node.js application. Project site http://lastbackend.com, User Guide - docs.lastbackend.com/guide.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question