RFC - Move tide requests to serverMiddleware #1016
Unanswered
dylankelly
asked this question in
Request for Comment (RFC) discussion
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
Currently all requests for CMS data needed to render a page in a Ripple frontend are made by calling the Drupal resource directly from the frontend via a proxy request to /api endpoints. A typical request to render a landing page might include the following requests
Making these requests in the Nuxt rendering layer has several disadvantages
Nuxt has a concept of serverMiddleware https://nuxtjs.org/api/configuration-servermiddleware which allows you to create a custom connect instance to render specified routes. This ticket proposes moving the current requests from the Nuxt context to this layer.
Moving these requests to a dedicated serverMiddleware would allow us to wrap all the logic for massaging data from Drupal JSON API to a usable page data model. This would be accessed from Nuxt pages in SSR asyncData hook by a HTTP GET request to the custom API endpoint eg /api/routes/nameofpage or some agreed routing schema.
The advantages of using serverMiddleware are many :
Proposal
WIP - further detail to come
Beta Was this translation helpful? Give feedback.
All reactions