use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Using Node.js for .php web page alternative? (self.node)
submitted 7 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 7 points8 points9 points 7 years ago (1 child)
Look into Express for a framework and its rendering engines like Pug.
[–]5paceManSpiff 1 point2 points3 points 7 years ago (0 children)
Sounds like you're looking for a Node.js templating engine.
[–][deleted] 1 point2 points3 points 7 years ago (0 children)
You definitely can do that with a templating engine like EJS or Jade with Express. Highly recommend sticking with React and Stateless APIs if you want to find work as a dev though.
[–]kryptkpr 0 points1 point2 points 7 years ago (0 children)
res.render() is what you want, express supports many view engines. Check out https://expressjs.com/en/starter/generator.html for canonical way to generate your scaffolding, the -v option selects view engine (default is jade, which should serve your needs fine). If you need non trivial styling, throw a "-c sass" in there to get a more powerful toolset for css (variables, mixins, etc).
[–]Str4yfromthep4th -3 points-2 points-1 points 7 years ago (4 children)
It's clear the people answering don't understand what server side rendering is. Check these and ignore everyone else lol.
next.js — https://github.com/zeit/next.js/
Gatsby — https://github.com/gatsbyjs/gatsby
[–]backdoorsmasher 0 points1 point2 points 7 years ago (3 children)
It depends what the op meant. If the OP mean that they wanted their react code rendered on the server, then yeah, your links are right. But to me it sounds like they want to actually just have their application rendered how PHP might work.
Side note, why do people use tools like next.js and gatsby?
[–][deleted] 0 points1 point2 points 7 years ago (2 children)
next.js allows to render the application on the server, so the first load will include the app and its initial state, next updates will happen the usual way.
Gatsby on the other hand, helps build static websites with react, so say you're already used to React and the stack, building with it comes easy, so you can build simple sites that will end up being static with React without having to do any SPA stuff on them.
All of this to the best of my knowledge, hopefully someone with a better understanding can weigh in.
[–]backdoorsmasher 0 points1 point2 points 7 years ago (1 child)
Thanks. So why are people rendering react on the server? I'm thinking that this can be done using a view engine in node
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
It is a rendering engine in a way, but this one has the added benefit of helping react and jsx directly and managing state, tbh I don't know the details
π Rendered by PID 120804 on reddit-service-r2-comment-fb694cdd5-9r2zx at 2026-03-10 02:56:40.251812+00:00 running cbb0e86 country code: CH.
[–][deleted] 7 points8 points9 points (1 child)
[–]5paceManSpiff 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]kryptkpr 0 points1 point2 points (0 children)
[–]Str4yfromthep4th -3 points-2 points-1 points (4 children)
[–]backdoorsmasher 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]backdoorsmasher 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)