0

I have a node.js server :

08/07/2019  17:52            14 545 app.js
06/07/2019  21:04    <DIR>          node_modules
06/07/2019  21:04            51 299 package-lock.json
06/07/2019  21:04               496 package.json
08/07/2019  17:53    <DIR>          public
08/07/2019  12:52    <DIR>          uploads

I have en entire angularJs website with a front end router that is working well, and is using the node app.js file as a back end for mongoDb, with some $http queries.

This angularJs website is hosted on a external apache server, and make calls to the node.js server through https using an angularjs service.

This is the angularJs app :

08/07/2019  17:57            15 398 app.js
17/06/2019  19:45    <DIR>          bower_components
05/06/2019  15:59                70 cache.manifest
17/06/2019  19:45    <DIR>          class
17/06/2019  19:45    <DIR>          connexions
17/06/2019  19:45    <DIR>          controllers
17/06/2019  19:45    <DIR>          css
17/06/2019  19:45    <DIR>          directives
17/06/2019  19:45    <DIR>          img
08/07/2019  17:12            14 984 index.html
07/07/2019  20:51    <DIR>          js
17/06/2019  19:45    <DIR>          librairies
17/06/2019  19:45    <DIR>          libs
17/06/2019  19:45    <DIR>          mail
17/06/2019  19:40    <DIR>          myApp
17/06/2019  21:14    <DIR>          services
06/07/2019  20:36    <DIR>          tickets
07/07/2019  20:46    <DIR>          vues

Now, i have transfered the whole angularJs app to the node.js server PUBLIC directory.

But, when i type

node app.js

I can't see the angularJs app working, when browsing to

http://localhost:3000/public

I would really appreciate if somebody has an idea on how to make it work ?

How could I reach the angularJs website in one go, from the node.js server ? Is it possible ?

I don't want to redo all of the routes ! I don't need it, it is all done by the front end . I only need node.js to display the index.html and to run the whole front end app .

1 Answer 1

1

All the thing is in app.js there.

You should add static routing in nodejs server config.

app.use(express.static('public'))

Then, the nodejs server will serve angularjs's entry point - public/index.html.

Please refer to this for detailed explanation.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you ! I'm trying out now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.