Open
Description
const AlanService = require('../../services/alan/alan.service');
const Container = require('typedi').Container;
exports.readAll = async (req, res, next) => {
try {
const alanService = Container.get(AlanService);
const result = await alanService.alan();
responseJson(req, res, result);
} catch (error) {
console.error(error);
errorHandler(req, res, error, next);
}
};
error log:
ServiceNotFoundError: Service with "MaybeConstructable<AlanService>" identifier was not found in the container. Register it before usage via explicitly calling the "Container.set" function or using the "@Service()" decorator.
This error occurs after version 0.8.0.
Your guide explains that when a service is used as above, it checks for the existence of an instance and creates or retrieves it when .get is called. And the above code worked normally until 0.8.0. Can you explain how the usage has changed from the next version?
Your official document also doesn't work.