Though there are plenty of solutions for NodeJS backends but I can hardly find any solution to host NestJS backend in a shared hosting cpanel. As of the time of writing this, there's hardly 3-5 questions related to this in stackoverflow and some of them aren't even answered yet. Those which are answered, the answers aren't sufficient for any beginner.
All I can assume is that, as NestJS is totally written on TypeScript,it needs to be compiled into JS. Nest project has a dist folder, which contains the total project complied in JS.
But how can I host it in Cpanel? (any thorough answer will be appreciated)
Related
I wanted to start a full stack project, with all the tech stacks in the market i am confused to which one should i pick. I know reactjs in frontend, nodejs and a little bit of django in backend.
First should i use Reactjs or any other frontend framework which is a single page application so all the JS code will execute from frontend or should i use that or Nextjs which does the server side rendering so in the browser we reduce the execution of js. If i stick with Nextjs then suppose i wanted to create a mobile app for my project can i use the nextjs for that or should i shift the code entirely
2)Does backend language really matter, if matters which language should i use and If it doesn’t matter then in nodejs which server framework should i pick(ex: expressjs)
Should I go with server or serverless while creating the api then it does not matter with the framework(because lately I have seen many realtime apps backend code is entirely wrriten by serverless functions using cloud)
4)tell me some of the important things i should use in a realtime app like docker, Kubernetes, load balancer, and any other things you might think this should be present in the full stack app
if you know any blogs or articles about choosing the architecture for ur project comment down.
This is a very opinion and experience based question that cannot be answered as you are asking it (and is technically out of scope in stackoverflow). I will try to help as much as possible anyway.
In general many different stacks are viable and in order to be productive it is more important that you are experienced in what you decide to use. This is because most technologies have pitfalls that can only be avoided by knowing them / experience.
Besides the frontend technologies/frameworks you listed there are many others. Having some experience with React-Native as well, my personal current favorites would be Angular and Flutter (both Google technologies) for web/apps.
It does and it doesn't matter. Without knowing your specific requirements no recommendation can be given though. As a general hint I recommend to use a language that your developers love - There is usually a reason for it. See the 2021 Stackoverflow Developer Survey.
Server vs. Serverless is mostly a business decision and you have to model your costs including hosting / development / maintenance efforts vs. usage models. Another aspect in this decision is time-to-market pressure since Serverless may be a bit faster to finish in some scenarios.
This cannot be answered without knowing the details and requirements of your project. Recommendations could be from hosting a static single web page in a S3 bucket to running your own fleet of (cloud-)-bare-metal clusters or buying a supercomputer.
Im moving to MEAN stack, and I am migrating an application originally developed with .NET framework to Angular and Node, but using mssql with Node, so its not really a mean solution. Anyway, so far Im fascinated with the simplicity and coding speed of Node.
Im utilizing Nodemon at the server, and developing from home in Angular. I opened port 3000 at the server and I point my angular http calls to http://xxx.xxx.xxx.xxx:3000. Everything is perfect so far; but at some point I will have to move to production and that's where my doubts begin.
I was reading several articles on the Internet about running Node on an IIS by utilizing reverse proxies, URL rewrite, installing PM2, installing Node as a service, etc; but I am not quite convinced this is the right way to expose the APIs to the internet. Some articles say IIS is "the way to go" while others say it may cause conflicts when Node crashes (?).
The question is then, is it recommended to run Node over IIS, which is what I know and Im confortable with, or should I use Express to expose my APIs to the internet?
Thanks.
I'm developing a MEAN stack-based application,I've some doubts about the file structure,I'm considering three options:
Frontend(Angular) served by Apache and REST API on NodeJS divided by port(80/443 and 8000)
Frontend(Angular) served by Apache and REST API on NodeJS divided by subdomain(www and api)
Frontend(Angular) and REST API served both by NodeJS divided by routes (/page and /api)
I've searched online, but I haven't found nothing
Personally I'd go with the last option on your list: "Frontend(Angular) and REST API served both by NodeJS divided by routes (/page and /api)".
I saw an answer on here recently that said:
When you serve a node.js app note that you are the author of your own web server. Any potential bug in your app is a directly exploitable bug on the internet. Some people are (justifiably) not comfortable with this.
Adding a layer of Apache or Nginx in front of your node.js app means you have a battle-tested, security-hardened piece of software on the live internet as an interface to your app. It adds a tiny bit of latency (the reverse proxying) but most consider it worth it.
This used to be the standard advice in the early days of node.js. But these days there are also sites and web services that exposes node.js directly to the internet. The http.Server module is now fairly well battle-tested on the internet to be trusted.
Regarding security, this says to me that you shouldn't need things such as Apache or Nginx in front of your Node app.
In terms of opinion of file structure, I'd choose this option also just because I've worked in a number of places where they've done this and it's made interacting with the API simple, predictable and approachable for both internal and external parties who want to consume the API (I'm a big fan of companies using either api.mydomain.com or mydomain.com/api/).
However I guess this down to preference.
Evaluating Nodejs and trying to see if it will fit our needs. Coming from a rails world, I have a few unanswered questions despite searching for a long time.
Whats the best way to manage assets with Nodejs (Expressjs)? In rails, the static assets are a) fingerprinted for caching forever b) js and css are minified 3) scss is compiled down to css
Whats the best way to handled uploaded images from users such as avatars?
Does grunt help with minifying and gzipping html/css/javascript?
How can I avoid mutliple http requests to the server with Node. I don't want to make multiple http requests for every javascript asset I need. Rails helps here by combining all js and css files.
Also, is Mongodb the preferred solution for most projects? I hear a lot of bad things about Mongodb and good things about it. Having a difficult time deciding if Mongo can help with more reads than writes with probably 400-500 GB data in the long run.
Any help or pointers? Thanks so much for taking the time to point me to the right places.
For each of the point you mentioned I give you a few module examples that might fit your need. Remember that at every point there are much more modules serving the same purpose:
node-static (as a static file server), node-uglify (for minifying JS code), css-clean (same for CSS), merge-js, sqwish, and jake can help you with the building of the website (in this step you could plug-in the previous modules)
node-formidable is pretty famous
check out this question
checkout this question
I am not sure if it is the "preferred". It is the noSQL and the Javascript nature in it that makes it attractive. There are modules already for every type of database. ongo should handle that data. Depends also how large is one document. There are some limitations.
There is this Github Wiki page in the NodeJS project listing and categorizing many of the important modules out there.
The exact choice of modules also depends what framework will you use use to build the app. A pretty established (but certainly not the only one) is express. But you can find more on this topic here.
I'm about to develop a web app so i tought i could test the workload with a single Node client since it can make multiple calls to the server without blocking.
Looking at https://github.com/joyent/node/wiki/modules, in the testing section i foun plenty of frameworks, and my question is if someone can recommend or has heard good things from any of those.
I think this is a perfectly answer question, that's why im asking it here.
Edit:
The idea is to use node on the client side not the server that serves the webapp, so profiling would be out of scope when it comes to decide what node testing framework to use.