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
Related
The Issue
Hi, I made a GWT (Google Web Toolkit) website, but now that I am done, I'm not sure how to host the website.
The code is only client-side, so I'm not sure where the problem is.
I would be grateful for any advice on where and how to host a GWT website.
Here's the GWT app on GitHub: https://github.com/aryanka15/GWTCledgeTextParser
My attempt to use GitHub Pages: https://github.com/aryanka15/aryanka15.github.io
What I tried:
I tried using GitHub Pages, but it doesn't work, for some reason the JS file is not recognized by browsers or something like that.
The build Java with Ant Github Action doesn't work either.
I also tried using Google App Engine, but it is a very complicated process that I couldn't get working, and I would like to avoid it if possible.
Also, I used VSCode to develop the application, if that helps. I think that many of the Google App Engine plugins for IDE's like Eclipse are deprecated, but let me know if I'm wrong.
Thank you!
Nvm, I wasn't being very smart. I just had to change the html to index.html, make necessary adjustments in the js files, and added all the files inside war to GitHub with the same file structure.
I have made a web app using express and react, and I want to bundle it into a desktop application, is this possible using electron?
I recommend the tutorial at: https://www.electronforge.io/guides/framework-integration/react
This isn't too hard actually, you can find all instructions you need in https://www.electronforge.io/
To accomplish this, either your app keeps hosting it with express locally and electrons connects to localhost, or even better, do it by not hosting any servers and just keeping your JSX and html files in your project.
If you're using TypeScript and ES6, also consider taking a look here for some examples: https://www.electronforge.io/templates/typescript-+-webpack-template
This may be a dumb question, but is the default react app (created using npm create-react-app my-app) using node.js? I am confused because in my web development class at university, I had to download node.js to create react applications. However, I didn't have to do anything like creating a server or initiating a node.js file, which is described in w3school's node.js tutorial. Because of this, I found out that I don't even really know what node is used for, besides downloading packages like redux and whatnot.
create-react-app uses node.js for all of its dev tooling. Likewise, a lot of the tools you'll use in the React ecosystem (like webpack, prettier, npm), all run on top of node.js as well).
You'll most probably build your react app to a static file, in which case the production output will not require node.js, it will be html and javascript assets that can be served directly to a client.
Hope that helps! Let me know if you have other specific questions
Node.js is used for server-side while React.js is for the front-end part. So, no, you don't need Node.js.
Under development mode, yes. Create react app runs NodeJs with Webpack Dev Server to allow you get feedback when modifing files, start or stop the server.
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
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/