DEV Community

Discussion on: Express in React! React Backend! Whut?! 🤯

Collapse
 
renatorib profile image
Renato Ribeiro

not the same purpose

Collapse
 
taviroquai profile image
Marco Afonso

Considering rendering React in server side, Nextjs does this. What Am I missing?

Thread Thread
 
cliffordfajardo profile image
Clifford Fajardo • Edited

This is adding another level of abstraction on top of writing vanilla javascript code to generate a server code; so instead of writing the code that looks the your typical functional that looks like an express handler, you'd write this it seems

react-express -> spits out server infrastructure code

app.get('/', function (req, res) {
  ............other boilerplate code
  res.send('hello world')
})
Enter fullscreen mode Exit fullscreen mode

Side note: I really appreciated the power of declarative languages and built a better mental model on the when/why you would do this after reading Ch2 of Designing Data Intensive Applications by Martin Kleppman

A declarative query language can be more attractive because:

  • it is typically more concise and easier to work with than an imperative API

  • But more importantly, it also hides implementation details of the underlying code making it possible for the system to introduce performance improvements without requiring any changes to userland code Other examples

    • (SQL, you write declarative queries, the engine/query optimizer handles trying to generate the most efficient code for you under the hood given the declarative code)