How to host HTML node.js application - node.js

i have developed a simple webapp using socket.io and node.js and was wondering how i would deploy it to a server? My application uses an HTML file with a canvas element the user interacts with how would i deploy this, the css and the js files and the app.js file to the server?
thanks

In some hosting companies that support Node.js (like Nodejitsu and Heroku) you can deploy your static files as part of your application code. In other words, when you deploy your app both your code and static files (JS/CSS/Images) will be deployed.
The downside with this approach is that you cannot easily just change a CSS file like you can in a more traditional deployment where you can just FTP a new CSS file to the production server. You could bypass this if you host your CSS files somewhere else, though.
I don't have experience with AppFog but I suspect the same is true.

You have a 90 day free trial at Azure. Believe it or not but they have great support for node.js. Read more at http://www.windowsazure.com/en-us/develop/nodejs/

Related

How do i convert MERN web app to desktop app?

I have created a simple billing web application using Node, Express, React and MongoDB
However i want to convert it into a Desktop application for local machines.
I know it is possible using electron, but i don't know how to do it.
Can anyone help me or provide with necessary resource?
you can use this boilerplate to get start a new project with react and electron.
Your build HTML file will act as the view file for your electron app.Which should be build by react-scripts.Use express server in separate file and use the server.
Handle requests just like you do in a MERN app.you only need to set the view to the bundled HTML file.

How to serve static files from CDN after Heroku build?

I have a small web application written in node.js and nuxt.js. The app is running on Heroku. I wan't to improve the speed of the page, however I have no idea which way would be the most practical to implement a CDN service.
The deployment flow is like: after pushing to Github I use auto deploy to Heroku. After deployment the node.js-buildpack generates the new build. I would like to host somewhere the static .js and .css files but I can't acces them on Heroku directly.
I was thinking on write a node function and simply upload the dist files after building every time onto my CDN provider.
I'm just curious wether a more simplier solution exist or not.
Thank you in advence.

How to deploy Express app on surge.sh

I have Express app, and I have index.ejs file instead of index.html and I can't deply it on surge (page not found). I use 'surge' command in project directory and than I go to the domain where it was published but my project doesn't run there. How should I deploy it? Please help me, I need to do it right now
Surge.sh is for serving static files (html,css,media..etc). Since ejs is a server side rendering template engine it can't be served using surge.sh.
Note: You can upload node apps to Heroku for hosting.
Since you have learned express, you can also learn Svelte. its a React/Vue like framework that compiles everything into a simple html/css/js site that you can then deploy to your favorite static hoster like surge.sh or even github pages
You can't deploy the Nodejs website on surge.sh as these services do not support server-side rendering like handlebars, ejs or pug, etc.
Vercel, netlify also do not support templating engines. However, you can use openode.io as an alternative, or maybe digitlocean under their app platform.
You may want to try to bundle the project and then use surge to publish it. I am not aware of any tool that can do that for you automatically, it might require manual setting.
Check this article:
https://morioh.com/p/c6e73ed575bb

Running angular2 on hostgator (or any host)

I have started getting into angular2 recently and have previously used angularjs. This might seem like a very broad question but all of the tutorials show how to use angular2 on a local environment and show how to serve the app and navigate to localhost:3000 etc. So my question is how do I go about running my app on my hosted server. Like how do I get it to go to my app using www.mysite.com? Do I copy the files to my public_html directory or do I have do do something to make my domain go to the port the app is being served on? Or do I have to turn off apache and do something to use node instead? Any help would be apreciated.
is very simple:
Copy local files into remote folder
Execute ng build --prod
your domain root route should be myremoteFolder/dist
hope this help you
Angular is a frontend framework, which means it runs entirely in the browser. This means it's files are "static", they don't require a web server to dynamically process the way PHP files would. This means they can be hosted anywhere static files can be hosted such as AWS S3 or whatever directory you'd put your images and stylesheets on HostGator.
I'm assuming the localhost:3000 is a simple development server used for local testing. If it does more work than that, such as expose API endpoints that your Angular app calls to, then you'll need to find a host that can run NodeJS applications.

Do you need Node installed in your hosting environment for React projects

I am building some React apps and am starting to think about the process of hosting. I am currently with Media Temple, which is a Apache based hosting, and I am on their (gs) grid server plan, which from what I can tell doesn't support installing Node.
I just wondered, do React apps need Node on the server?
If they do, what could my alternatives hosting options be?
Many thanks :)
If you're doing universal rendering, you'll probably need a Node server to support this.
But if it's only a static one-page application, you could perfectly not install Node on your hosting environment.
Using webpack for example, you can create a single js bundle of your vendors and sources files, a css one, and an index.html, Leaving you with 3 static files.
No, react apps doesn't require node server

Resources