As we've explained, the service layer is already implemented, but InversifyJS hasn't been fully configured yet. Let's do it now and make sure that we can use dependency injection to get an instance of the MusicService service.
First off, add a few symbols to the src/ioc/types.ts file:
export const TYPES = { MUSIC_SERVICE: Symbol('MUSIC_SERVICE'), MUSIXMATCH_BASE_URL: Symbol('MUSIXMATCH_BASE_URL'), AXIOS_INSTANCE: Symbol('AXIOS-INSTANCE'), };
We'll use MUSIC_SERVICE Symbol as the unique token for the music service.
Next, adapt the MusicService implementation in src/services/music-service.ts to introduce the necessary InversifyJS decorators:
- Add the following imports on top: import {inject, injectable} from 'inversify';.
- Add @injectable() to the class.
- Add @inject(TYPES.MUSIXMATCH_BASE_URL...