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 @nrwl/nest
package to easily generate everything we need.
You do not need to be familiar with Nest (and you can use the @nrwl/express:app
plugin instead if you wish). All the NestJS 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 @nrwl/nest
-
Generate a new NestJS app, called
api
⚠️ Make sure you instruct the generator to configure a proxy from the frontendstore
to the newapi
service (use--help
to see the available options) -
Copy the code from the
fake api
to the new Nestapps/api/src/app/
app.service.ts and expose thegetGames()
andgetGame()
methods -
Update the Nest app.controller.ts to use the new methods from the service
-
Let's now inspect the project graph!
-
Inspect what changed from the last time you committed, then commit your changes
🎓If you get stuck, check out the solution