Many missing or unclear steps in the "Getting Started With API Platform with Symfony" page
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- docker, next.js, php, postgresql, symfony
- Ambito
- devops, documentation
Direzione di ricerca
Inizia dalla pagina «Getting Started with API Platform with Symfony» e confronta ogni comando con il compose.yaml generato e con l’output dell’installer descritti qui. Controlla i passaggi relativi a pnpm, Doctrine, alla ricostruzione del database, al profiler e al generatore di Next.js, quindi verifica la procedura con un progetto nuovo. Il lavoro è completo quando la pagina indica i prerequisiti e fornisce un percorso documentato funzionante, oppure rimanda chiaramente all’issue pertinente per i problemi al di fuori del suo ambito.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I've tried to setup a completely new project with the api-platform installer by following the documentation for symfony Getting Started with Api Platform with Symfony but I hit a few snags.
Installing the Framework
Scaffolding the Project
Executing the following command failed because I didn't have pnpm installed.
api-platform bookshop-api --framework=symfony --with-docker --with-pwa --with-admin
There is no mention until this point that pnpm is required for the pwa. Since the documentation for the Next.js Generator mentions npm, pnpm and yarn as possible package managers I would expect that creating the project would work with just npm or yarn installed.
After installing pnpm and running the command again, the installation succeeded.
I then ran the following command to start the containers.
cd bookshop-api/api
docker compose up --wait
The documentation states that two services will be spun up - php and database - but only the php service was started. It is mentioned, that the installer requires the Doctrine ORM bridge via api-platform/doctrine-orm - which is installed automatically - but that doesn't install the actual dependencies to use Doctrine or interact with the database.
Looking at the compose.yaml I can only see the php container and no database. But hidden in the compose.yaml is this comment
services:
php:
restart: unless-stopped
environment:
SERVER_NAME: ${SERVER_NAME:-localhost}, php:80
....
# Run "composer require symfony/orm-pack" to install and configure Doctrine ORM
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8}
so I've executed docker compose exec php composer require symfony/orm-pack to install the Doctrine ORM.
Installing this dependency modifies some files in the project. For example the Dockerfile to add the pdo_pgsql extension for php.
It adds the database service to the compose.yaml and adds a DATABASE_URL environment variable to the .env file.
These changes require the container to be rebuilt as it isn't just installing php dependencies but directly modifying the Dockerfile.
In my first attempt there was another issue after installing the orm-pack. Somehow the php container could not talk to the database container. I assume this was some networking problem and might be related to the DATABASE_URL inserted into the .env file.
It's Ready
I opened https://localhost and could access the swagger documentation. Trying out the GET /greetings route fails with a 404 error (which I have reported here: https://github.com/api-platform/api-platform/issues/3003)
Bringing your Own Model
After creating the two new classes with the #[ApiResource] attribute, the documentation mentions the Web Debug Toolbar. This toolbar is not automatically installed. You need to install it with docker compose exec php composer require symfony/profiler-pack
A Next.js Web App
I switched to the pwa directory and executed pnpm create @api-platform/client. It asked for some inputs but then just printed the help page of the client generator. No actual frontend was generated.
Looking at the documentation of the client generator I should run one of these two commands
docker compose exec pwa \
pnpm create @api-platform/client --resource book -g next
OR
pnpm create @api-platform/client https://demo.api-platform.com . --generator next --resource book
There is no pwa container configured through the Api Platform installer so I tried to run the second command (with https://localhost as url)
but that fails because of an invalid certificate ...
At this point I am pretty disappointed with the "onboarding" experience of api-platform and the installer.
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 181
- Fork
- 1.1k
- Merge medio
- 1g 10h
- PR unite (30g)
- 24
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di api-platform/docs
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
api-platform/docs#2284 ·
-
Graphql documentation Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
api-platform/docs#2310 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
api-platform/docs#2280 · 2 commenti ·
-
Needs Work
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
api-platform/docs#2133 · 9 commenti · 1 reazione ·
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 58/100
api-platform/docs#1450 · 2 commenti ·
Tutte le issue di api-platform/docs
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Azure/azure-functions-docker#1257 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
conda-forge/vowpalwabbit-feedstock#104 · 1 commento · 1 reazione ·
-
Add 4.2.2 Kafka version Apertagood-start
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
deploy.sh hardcodes --dest while components.conf advertises WITH_PROXY_CA_BUNDLE as env-overridable Apertaarea:proxy bug security severity:low track:open-source
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
components-web-app/docs#73 ·