We have created an application that runs on node.js using Angular2 but you have not launch it with "npm" which uses the lite-server. However, we are being told that we much run under IIS but the problem is npm loads all of the packages for you correctly, IIS and IISNode know nothing about all these packages we have downloaded via "npm". We have yet to see anyone who has ever created an Angular2 or even Angular application that runs under IIS using IISNode.
Does anyone know how we would have it load all the modules correctly?
I answered Mike's question within the issue he opened on the IISNode Repo on Github. Here are the excerpts from that issue answer.
Angular2, as far as I know, has nothing to do with IISNode and shouldn't present any issues with running your app in an IISNode environment.
IISNode provides a way to run node.exe on an IIS Server instead of using a process manager like pm2 or forever. You can run an Angular2 app hosted with a Node.js/Express backend easily by just following any examples for getting an Express server running in IISNode. Take a look at this tutorial I wrote on StackOverflow for getting an Express app running in IIS with IISNode. Once you've got your Express app running its just a matter of getting your Angular2 transpiled to a browser compatible JS version and serving that.
I was able to successfully run the Angular2 Quickstart in IISNode just now (I know this isn't a full blown app) and I also know I wouldn't have made my node_modules static but for the purpose of the exercise I have.
Here is the repo it works perfectly and loaded up just fine for me.
Just clone the repo, place on your IIS box and do npm i and you shou>ld be good to go. Make sure the app is reachable at root otherwise you'll need to do some additional work. Again I know this is simplistic but it is a demonstration that IISNode has no problem with loading the essentials of Angular2.
Related
I am trying to deploy a meteor.js application on cPanel shared hosting. I don't have access to their cli.
I have followed this tutorial Host your Node.js app on Shared hosting. Go beyond localhost.
Now I am having hard time with a couple of things. I can't find any tutorial specific for meteor.js which is why I am facing some issues. Which are as follows
1. Without meteor Build
I uploaded the development version of my code. i.e the one with client,server,lib folders(without meteor build). The problem is that I am not sure about the "Application startup file".
I tried with "./client/main.js" and "./server/main.js" seperately but the site then returns 503.
2. With meteor Build
I then built my application and the build was generated with some errors. I then uploaded the tar.gz file and went with the main.js as Application Startup file. But now the cPanel is unable to detect package.json
Can someone please refer to a full guide of how to deploy a meteor app with cPanel.
I have an application built with Create React App that I want to use Node.js as a backend to load data from a database. Basically, I want Node to load the data and then use Create React App to do stuff with it. To do so I used this tutorial: https://www.freecodecamp.org/news/how-to-make-create-react-app-work-with-a-node-backend-api-7c5c48acb1b0/. I have set up a working development environment where I have all the Create React App in a client folder, a server.js that loads the data (from MS SQL Server if that's relevant), and a proxy set in client/package.json (CRA's package.json) for the port that the node app is running on (5000 in my case). I then run yarn dev and these two servers run together and talk to each other and everything works great.
The issue is deploying. My organization uses IIS. From what I can gather Node and IIS are not the ideal combination but IIS is what we use for everything. I would like the server.js and the CRA to be in the same folder and to basically function like one app as much as possible (I know that Node will need to run its own server). I would also like a setup that can be easily changed or moved to another machine. What I've done thus far is:
Set up a single application with a client folder, which is the build for CRA, and then server.js in the root
In my react code, made API calls to http://localhost:5000 (in the development environment I could do fetch('api/somestuff') but to make it work in production I needed to do fetch('http://localhost:5000/api/somestuff') )
Installed pm2 and used it to run server.js and start the Node server
This worked, however I'm wondering whether this is the optimal way to do things. This worked on my local machine but I don't know what will happen when I put it on our production machines. Will the Node server block other applications? Will it stay running no matter what or might it crash? Ultimately this is going to be deployed in a multi-server environment where we have 2 load-balanced servers with identical code that are put through an F5 to form a single URL--will this impact anything?
I'm pretty new to programming so bear with me, I'm sorry if this question was confusingly phrased.
I suggest you install ARR to work with IIS as a reverse proxy, which can forward the HTTP request to the backend NodeJS server.
Besides, for cross-domain request forwarding in the rewrite action type, we need to install Application Request Routing, and enable the proxy functionality.
Here are two examples of applying this feature, please check it.
How to successfully run node server with IIS?
ASP.net URL Rewrite subdirectory to external URL
Feel free to let me know if there is anything I can help with.
I have node js api and it works when starting using nodemon from node terminal. Now I want to deploy it to IIS. How can I do it? Please reply, it is important.
To run Node.js apps on IIS on Windows, iisnode module is needed. Please follow this article to get going. Primary requirement to run your Node.js app on Windows is the iisnode module. If you follow the instructions carefully, you can get it working pretty quickly.
PS: You would also need to assign user IIS_IUSRS READ permissions to the folder (and its parent folder) which contains your Node.js API sources. web.config which mentions the iisnode module is very important for everything to work smoothly.
I have an node js express app for service module and angular app for web, which is deployed in the windows 10 iis server at the domains
"http://localhost:8011" and "http://localhost:8012"
If i test the site in my browser like
"http://localhost:8011" and "http://localhost:8012"
or
"http://{port number}:8011" and "http://{port number}:8012" it's working
but if same thing i open in others computer the angular application is working without any issue.
but the node js is not working
it's giving the error like
This site can’t be reached
{port number} took too long to respond.
Can any one suggest me what is the error and how to resolve this issue.
Thanks in advance.
It is not very clear from the question but from what I understand you are trying to serve a node express app through IIS?
If this is the case, you should look at the iisnode package which is really helpful. You will also need to install the IIS rewrite-rule module if this is not already installed.
If this is indeed what you are looking for let my know, and I will edit me answer to include more details.
I've been working on building a video conferencing application by following this tutorial.
It's a great tutorial, and everything worked awesome when developing. However, when pushing to production I had issues and I'm not well-versed enough with these tools to figure out what's wrong.
I changed my NODE_ENV=PROD in my .env file. Which should trigger the production express build located here. (tutorial github link)
Next, I ran npm run build as I wanted to build my bundle.js, etc in the dist/ directory. I copied the three files from dist/,
bundle.js
common.js
index.html
Into my web server's directory, but now when visiting /token route, I get a 404. This doesn't happen on DEV, so it has to be something with the way the express server.js is written.
Unfortunately, I'm having trouble deducing what the issue is.
Environment details - I'm using a hostgator account, and copying files into the cpanel file manager. I've hosted lot's of JS applications like this before, but usually if I'm using a back-end it's a django server, so this (express) is new for me.
It is because express server is not running in your production environment. As express is used to build web server listening on specific port. In your case you have deployed the static files but the server is not running.