-
-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Description
Hi,
I've been trying for a long time to set up Vulcain with Api Pltform without success. I have the feeling that it is more a Vulain issue as I never found how to make it work through Caddy module.
Here are my steps to reproduce the issue (largely inspired form your demo):
Download Api Platform v3.0.9 release
curl -L https://github.com/api-platform/api-platform/archive/refs/tags/v3.0.9.tar.gz
tar xzvf v3.0.9.tar.gz
cd api-platform-3.0.9Fix PNPM issue as stated here: api-platform/api-platform#2417
Configure the API to be Fully Normalized
# api/config/packages/api_platform.yaml
api_platform:
defaults:
normalization_context:
iri_only: true
# ...Start the app
docker compose up -dCreate entites like here https://github.com/dunglas/demo-vulcain-api-platform
Update schema + load fixtures :
docker compose exec php bin/console doctrine:schema:update --force
docker compose exec php composer req --dev alice
# api/fixtures/data.yaml
App\Entity\Conference:
conference_{1..10}:
name: '<catchPhrase()>'
App\Entity\Session:
session_{1..100}:
conference: '@conference_*'
title: '<catchPhrase()>'
summary: '<sentences(3, true)>'
author: '<name()>'
App\Entity\Feedback:
feedback_{1..100}:
session: '@session_*'
comment: '<sentences(3, true)>'
rating: '<numberBetween(0, 5)>'docker compose exec php bin/console hautelook:fixtures:load
Try with this code: (inspired from your demo)
<!DOCTYPE html>
<title>Maximum waterfall: API Platform X Vulcain</title>
<script>
async function fetchJson(url, opts = {}) {
const resp = await fetch(url, opts);
return resp.json();
}
(async function() {
// Load ALL data from the API
console.time('download');
const conferences = await fetchJson('/conferences', { headers: { Preload: '/hydra:member/*/sessions/*/feedback/*' }});
// const conferences = await fetchJson('/conferences');
// Fetch conferences
conferences['hydra:member'].forEach(async conferenceRel => {
const conference = await fetchJson(conferenceRel);
// Fetch sessions
conference.sessions.forEach(async sessionURL => {
const session = await fetchJson(sessionURL);
// Fetch feedback
session.feedback.forEach(async feedbackURL => {
const feedback = await fetchJson(feedbackURL);
})
})
})
console.timeEnd('download');
})();
</script>With Slow 3G throttling + Disable cache in Chrom DevTools I get the the cascade profile like here on the left:
Is there anything more to do to enable Vulcain?
Metadata
Metadata
Assignees
Labels
No labels