-1

I used to think that Node was only used in the server-side app because of the use of the npm command and the ensuing generation of the node_modules folder.

But I noticed that CRA also uses node, so does that make the front-end a Node app?

I appreciate any clarity on this!

HJDesulme
  • 16
  • 6
  • 1
    Express is explicitly node based. Generally with these acronyms it's understood that node is going to be the backend. npm packages exist for both the client and the backend – Phix Oct 27 '20 at 22:12
  • Thanks for your response. I should have rephrased. So npm packages existing for the client =/= the client being a node app? – HJDesulme Oct 27 '20 at 22:27
  • NodeJS is for the backend if you're running a node app, i.e. accessing the file system, http request etc. npm is a package manager which has both client and backend packages. MERN for example is Mongo (server) Express (server) React (client) and Node (where all the backend packages are run). That doesn't mean you don't install react from npm though. – Phix Oct 27 '20 at 22:30
  • Alright, I just rephrased (completely changed ) the question to get more to the point of what I'm trying to figure out. – HJDesulme Oct 27 '20 at 22:41
  • The front end will never be Node. `npm` !== Node. npm is a package manager. No idea what CRA is. Your front end will be using things like react, ember, handlebars, angular etc which are all (usually) installed via `npm install `. NodeJS is what will handle your backend, usually the API in a single page application (SPA). You'll find a lot of questions where people ask "why can't I use the `fs` package in my front end application?" Because `fs` is meant to run on a node server. – Phix Oct 27 '20 at 22:45

1 Answers1

0

Are you talking about the resultant web application created by CRA? No, it's not a Node app. It's a web app. It doesn't need Node. The resulting development environment uses Node as the backend http server. For production generally any http server can be used.

squillman
  • 13,363
  • 3
  • 41
  • 60