Wednesday 31 May 2017

How to use the same view in FrontEnd and express server-side rendering?

I have a partial view that is used on server-side rendering to build a HTML page and also in FrontEnd to make a partial update on the UI. BecauseI want to use the same partial view file on both server-side and FrontEnd, I was looking for the best approach to share this file between the two sides.

For now, TBMK I used the following approach:

  • Placed the partial view file in /public folder which is served by express static middleware.
  • The server application loads the partial view from the file system.
  • The FrontEnd loads the partial via an AJAX HTTP request.

Is there any better approach?



via Miguel Gamboa

No comments:

Post a Comment