React App is not Deploying to Website after being placed on Server - node.js

I am trying to create/upload/host a website and I am somewhat unfamiliar with the requirements/processes in place. I have created the start of a react app using the WebStorm React template, and now wish to add it to my domain server so I can test connecting it to a MySQL database.
I can run the app in development mode and it works. So, I ran "npm run build" and placed the resulting build folder onto my server using cPanel (hosted on GoDaddy). I thought this would deploy my app, but it still displays the default page of "If you're the site owner, log in to launch the site". Is this because there is no index.html file present?
My upload contains: server.js, package.json, assets.json, LICENSE.txt, yarn.lock, a "chunks" directory and a "public" directory.
Are there any large flaws in my thinking, is there anything else I need to do to deploy my React App? I have tried searches but nothing has resulted in what I need.

Related

Publishing NextJS to IIS

I'm trying to publish a NextJS website on IIS, I've already installed URL Rewrite and IIS Node on the server, I tried following this guide to set up a reverse proxy, but that didn't seem to work, as even though I was running the project on the server, it wasn't redirecting to it.
I then tried hosting with a custom server, this works when running locally, but when run next build, copy the generated .next folder, package.json, web.config, and server.js onto the server where IIS is being hosted, running node server.js doesn't seem to work, as it simply stops after:
info - SWC minify release candidate enabled. https://nextjs.link/swcmin
No other question or blog I see seems to cover hosting on a different computer than the one used to develop, so I'm not clear on whether or not I'm simply supposed to copy the entire source code to the production server, and run next start there, that would not seem ideal.

Can't deploy web service on azure

I have been trying to create a web service all day in azure using node js,
I cannot seem to figure out what to do, every time I get a different issue,
I created a simple express app and committed to git, afterwards connected it to azure web app just like in this tutorial:
https://www.youtube.com/watch?v=-zjnOTZxuEU
After that I am getting this page:
image
I tried to remove the hostingstart.html from the default document but then i am getting a page telling me I don't have permissions,
What to do in order to get it working?
You can see the express app here: https://github.com/orizvida/new
Your API method has no path defined:
app.get('/',(req,res) => res.send("hello"));
Should be like:
app.get('/hellomessage',(req,res) => res.send("hello"));
If you are new to this, you could follow this steps:
Create a simple express project by this command:
npx express-generator
npm install -g express-generator
express
express --view=pug {your-app-name}
cd {your-app-name}
npm install
Upload to GitHub. Here is the file structure:
Create a Web App on Azure.
Navigate to Deployment Center, set deployment from GitHub, choose your repository, and save settings.
Go to GitHub, and see the Action logs in your repository:
Go to your website to see the result: https://dorisnode.scm.azurewebsites.net/, and go to this site to see the file structure: https://{your-file-name}.scm.azurewebsites.net/wwwroot/
If your Web App based on Windows while creating, you might need a web.config file to make IIS recognize your project, see here.

Error in publishing react website on IIS server [works in the local]

I couldn't run the (asp.net) React.js site in one turn. First of all, I publish the site from Visual Studio to the httpdocs folder on the server. In the image below, you can see the file structure under httpdocs.
Then I set up the node.js as seen in the second picture attached. Here, I specified service-worker.js file as application startup file. But I'm not sure about that. Do you think these settings are correct?
Right now the site returns the error ReferenceError: self is not defined, the source of the error is service-worker.js. All the code works fine on my local computer. I think the error is about the way I configured the node.js. Any help_

How to get standard out from a Node.js application in Azure?

We have a Node.js application with a pretty big codebase that we're trying to deploy to an Azure Web Site. My problem is that when I deploy the app and try to access it, I just get a message saying "The page cannot be displayed because an internal server error has occurred".
According to http://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-debug/ I should be able to configure some settings and have my standard out be logged to a file - well, it's not working. in /LogFiles I can see /git, /html, and /DetailedErrors, but none of these folders contain the stdout logs.
I have deployed the app using Visual Studio. I created a blank Azure project, and manually added all the folders and files I need. I also created an iisnode.yml file that contains the following config:
loggingEnabled: true
devErrorsEnabled: true
logDirectory: ./logs
debugHeaderEnabled: true
The last two lines I added later, the first ones are from the tutorial. I also have a web.config file, the contents of which I haven't really touched.
I've attempted to configure the settings that are available in the Web Sites UI, but I haven't really been able to make any headway. I think currently they are pretty much default.
I'm sorry that I can't provide you with more information. I'm really kind of banging my head against the wall here, since all the tutorials I've found basically state that if I do this and that, everything should work. The problem is, it doesn't. Sad face.
Edit: I should probably add that my server.js is in a folder called /NodeServer. It's not in the root as Azure seems to presume.
Edit2: I deployed a Hello World example and got it to work, but when I try to move the server.js file from the root I can't get it to work anymore.
I've added a tag to the web.config, so that the structure is basically
configuration
location path="NodeServer"
system.webServer
I've also edited my package.json so that it says
"main":"NodeServer/server.js",
"scripts":{
"start":"cd NodeServer && node server.js"
}
If the app is started successfully, you should be able to find the stdout at
D:\home\LogFiles\Application
in Azure Websites, without configuring anything.
But here it looks like an error related to incorrect/missing web.config. The node app may not get launched. You can try:
Publishing your app using git to Azure Websites.
Or if you are familiar with IIS and iisnode, make sure your app works locally with IIS and iisnode. See http://tomasz.janczuk.org/2011/08/hosting-nodejs-applications-in-iis-on.html
Or try publishing an "hello world" node.js app to Azure Websites, take the generated web.config and modify it for your app.
Edit: When you change the location of server.js, you have to change web.config too. The change in web.config is not correct. And package.json is only used as hints to generate web.config during git deployment. To get your "hello world" to work, you can either
In your web.config, replace all "server.js" with "NodeServer/server.js".
Or deploy the modified app using git. Make sure it does not contain the wrong web.config.
Then you can try to get your larger app to work.

cakePHP, what to do next?

I've followed some tutorials about cakePHP and now it's done, the "mvc" is ready.
What should I do next?
Meaning: I was working locally, can I simply upload the complete app online and it is secured as 'they' meant it to be?
I've downloaded the 1.3.6 package from https://github.com/cakephp/cakephp/archives/1.3, and deployed it as is in a folder named as my domain.
Edit:
I have win-xp with wamp.
I created the app by simply unzipping the file to a folder and then renamed it to 'domain_name'.
Then I made the db connection and set the configuration files.
At that point I created the models, views and controllers.
Now the application is working, locally.
My question is: can I simply upload everything to my server, to the html root folder and say that "I am done"?
As long as your app isn't already in production, putting it online can tell you more about how it's working. For instance, you'll learn if there are missing modules or dependencies that must be installed on the live server.
If it's an already live system, you may want to use an online staging server to understand what needs to be modified on the production server in order to have a smooth deployment.
There are three ways that you can deploy your cake app (Development, Production and Advanced), and all of them are secure:
http://book.cakephp.org/view/912/Installation
I would recommended the Production install if you aren't going to run any other apps on this server.

Resources