Up until now we've had a single app in our repository, and a few other libs that it uses.
But remember how we created that fake-api
way back in the second lab, that only our store
app can access?
Our new routed component suddenly needs access to the games as well, so in this lab we'll be adding a completely new app, this time on the backend, as an API. And we'll use the @nx/express
plugin to easily generate everything we need.
All the Express specific code for serving the games is provided in the solution.
- Explore other plugins in the Nx ecosystem
App Screenshot
No change in how the app looks!-
Stop any running
nx serve
instance -
yarn add @nx/express
ornpm i -S @nx/express
-
Generate a new Express app, called
api
⚠️ Make sure you instruct the generator to configure a proxy from the frontendgame-store
to the newapi
service (use--help
to see the available options) -
Copy the code from the
fake api
to the new fileapps/api/src/app/
games.repository.ts -
Update the Express main.ts to use the repository data
-
Let's now inspect the dependency graph!
-
Inspect what changed from the last time you committed, then commit your changes
🎓 If you get stuck, check out the solution