March 22, 2020
Estimated Post Reading Time ~

Integrate PWA & AEM and retrieve the AEM content from PWA.

I hope the Content Fragment and related changes are published already.

Now let us enable CORS, Anonymous access in publish environment.

Step 1: Add CORS details:
Since we are going to access the Content Fragment from an external application, we may get CORS error(Cross-origin resource sharing). To enable the CORS access, we need to make some changes in AEM publish instance.

Go to AEM system > Console > ConfigManager > Apache Sling Main Servlet

Click on (+) icon and add a new property for 'Additional response headers' as 'Access-Control-Allow-Origin=http://localhost:5000'

The new Content Fragment Model is now anonymously accessible on AEM Publish.

Now go back to the PWA home page and click on the button, you can see that data is retrieved from AEM as shown below.
We now created a sample PWA and pulled content from AEM.

If you face any issue and need help in running this demo, please let me know through the comments.



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.