Problems with a node.js and handlebars.js project deployment - node.js

I have a project with node.js, express and handlebars as a template engine. I had it deployed in Heroku but since they are going to charge for the deployments I am looking for a free alternative.
I would love some help/ideas.
Thanks in advance!
I have tried with Vercel but I am incapable of deploying it correctly. It displays only my index.js file, in which I have the settings for handling the routes.

Related

How to deploy a React App with SSR on cPanel?

so here is the thing, I have created a react app with server side rendering (with babel and webpack and an express server). I was able to run it locally. So far So good.
Now I want to publish it on the web, and I am clueless about how to do that, there isn't much documentation about that and I wasn't able to get an answer so far.
Any help would be appreciated.
Thank you in advance.
If It's an hobby project you can do that with Heroku. It's free. Else you can buy a Heroku premium or Digital ocean or AWS EC2 server

Issues deploying monorepo containing Next.js + Express app to Heroku

I am following Ben Awad's wonderful tutorial to build a fullstack
app using Next.js, Express, Typescript, and GraphQL. Everything works smoothly locally, but I have run into a barrage of issues trying to deploy to Heroku. I would really like to deploy both server and client to Heroku as one app, and have Express serve the frontend files as well as be the backend.
monorepo
- web
- package.json
- server
- package.json
package.json
To my understanding, this is possible using Next's custom server option, which I have integrated in my server.js file. My problem is when deploying to Heroku, it doesn't detect React as a dependency for the backend so while the deploy succeeds, the app crashes when I try to access it in the browser. I have tried a few things to resolve this issue - having two copies of React in frontend and backend, respectively, only leads to more problems (understandably so). I have tried keeping one copy and using npm link to point to the module, but it only works locally. I've tried changing the webpack config as well but it doesn't seem to register. I tried defining the custom server as a util in the frontend and import it in server.js, but the import is always undefined, which makes sense so I moved it back.
I'm still new and have many misconceptions about how Next.js works, especially when coupled with a custom server, so I might be doing something fundamentally wrong. Is there anything I'm missing, or is it better to split the app into two Heroku apps and push one subtree into each?
The source code can be found here, but I will be probably rolling back because it has become very messy.
I know there are other ways to do this I just don't want to give up quite yet.

Deploy Nodejs + ReactJs to Heroku

I'm learning how to deploy a web site to heroku.
My web app has a nodejs project and one mysql in the server side, a reactjs in the client side.
Can you show me the steps that I need to do? Because I'm new to this.
Thank you very much
Here is a step by step guide.
Put your app aside for a few moments and follow these:
To learn how to deploy a nodejs
https://devcenter.heroku.com/articles/deploying-nodejs
Now learning how to add a mysql database
https://devcenter.heroku.com/articles/cleardb#provisioning-the-shared-mysql-add-on
This will teach you how to deploy a 'raw' react app
https://blog.heroku.com/deploying-react-with-zero-configuration
Now, it's all about how you want things to be. You can have a route on your nodejs app that serves the index.html with the react app or a separate app for nodejs and for react. You should probably make them separated, just to keep things organized, but since it's your first deploy and you're probably using it as a hobby or to learn, any way is correct as long as you get it to work. Then you can build on top of that, split the apps into two, or maybe host the react app on aws s3. Who knows?

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

Convert an AngularJS app into a "standard" Node.js app to be friendly deployment of Node.js Hosting

Sorry my question is Novice, but I wont to do that in order to be an AngularJS APP friendly of deployment of any Node.js Hosting.
I found something like that by Meteor: "https://github.com/onmodulus/demeteorizer" but i can't found by AngularJS.
Or some way to build with Grunt, for instance: "grunt build node-js" and the "dist" folder containt all the files need to deploy in any NodeJS Hosting like CloudBees.
It is possible something like that?
thanks a lot!
Jero
PD: I do not want to deploy my Angular APP in Heroku.
Your question is very unclear, but if you are looking to develop with Angular and node, consider http://meanjs.org/, it is a full-featured stack for precisely this application.
You also have other. MVC frameworks such as sails.js and gedddy.js, or the more barebones express.js

Resources