mercredi 4 novembre 2020

Serve HTML based on data from POST request?

I'm a bit confused as to how to architect this.

I want to serve an HTML form based on real-time "incoming" data.

I wanted to use ReactJS, but I know I can't accept POST requests to the React application. Which means I need to use a web server to serve my web pages. I've been looking at ExpressJS + a template engine.

My question is, isn't this an anti-pattern? I wanted to separate my frontend & backend layers, but I can't really find a better way to serve HTML based on real-time data from a backend.

Things I've tried:

  1. Fetch data from ReactJS to backend; But storing real-time data in a temp database seems dumb and cumbersome.
  2. Socket.io; But wouldn't it be harder to differentiate each ReactJS "session" between each other. (Ensuring data doesn't leak between each web page etc.)

Thoughts? Am I headed in the wrong direction here?

Aucun commentaire:

Enregistrer un commentaire