I am trying to send data from my express server to the client side.
I have used app.post and app.get, the problem i'm having is that with either of those, the request must come from the client side. I need to send to push the data from the server side once a script has run has finished.
What i am doing is:
- Client inputs data on client side
- Data is send to the server using app.post api
- Server runs script
- Server sends data back to client side
For server to client communications, look into client-side libraries such as axios or ajax.
If you are suggesting something that for example: user inputs data to form, server responds with a new page, you may be seeking a template engine. In that case, look into the Express Docs for a template engine.