V
V
Vitaly2015-09-29 21:34:32
JavaScript
Vitaly, 2015-09-29 21:34:32

How to run an Angularjs project on a nodejs server?

Hello, tell me how to properly run a site written in angularjs on the server?
Let's say I created a site in angular, and now I want to throw it on the server for full-fledged work.
Will it be right to raise the server to nodejs (for example, express) and then somehow attach my angular project to it?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vitaliy, 2015-10-01
@Scorpiored88

I recently started learning angular. Made some projects for myself on angular PhoneGap with api server on node express.
The fact is that the angular PhoneGap application launches the phone itself (or the server on it, I don’t know for sure), that is, I don’t manually feed angular to some kind of server ... In the office. The documentation, namely in the tutorial, angular, briefly says about some simple server on the node and that's it ...
I just want to understand the principle of operation ... who feeds what to whom ...
Let's say I have several html pages, for in order to open them by going to the given address, I will start the server on the node (express) which will actually render these pages and respond to get and post requests, etc... everything is clear here.
And what about Angular? Will it be correct if I send response.render(index)... index.html to the same server upon request to a certain address, to which everything is actually attached in this framework? Will it work at all?
Or is it another principle here, we launch the simplest http server from the example in the tutorial about Angular, on our server and that's it, that's enough ..., this is the release ..., and thus my angular project is published?
Chew please, otherwise I’m writing in angular, and I use expressOM and connect different modules, but I don’t know where and how to tie my site to angular (with the exception of PhoneGap) .... :(
P.S. Sorry for the mistakes I'm writing from my phone now

3
3luyka, 2015-09-30
@3luyka

Why not? As far as I understand, Nodejs will play the role of a certain API that will only return the given one.

V
Vladimir Io, 2015-09-30
@vawsan

Well, just take care of the return of your site to the node.
For understanding - read how MEAN works

A
Alex, 2015-09-30
@streetflush

Of course, you can, only if you just need an HTTP server, then express is not needed either ...
And if there is an API for data, then express can perfectly distinguish between requests and configure routing to data or statics.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question