Giải pháp chuyển đổi số trọn gói cho doanh nghiệp Việt
Tại thư mục apps/ecommerce/views/carcategories
Tạo file view view.json.js
Nội dung file
const htmltoobar = require(`${path_root}/lib/Html/HtmlToobar.js`);
const factory = require(`${path_root}/lib/Factory.js`);
const fs = require('fs');
const viewfrontend=require(`${path_root}/lib/mvc/views/view`);
class carcategories_json extends viewfrontend{
static async display(view, type, req, res, next) {
const root_path = req.handlebars.helpers.get_root_path();
const model = require(`${path_root}/lib/mvc/models/model`);
const input=factory.getInput(req);
let doc=factory.getDocument();
switch (type) {
case "list":
const modelCarCategories = model.getInstance("carcategories",0,req, res, next);
const list = await modelCarCategories.getList(req, res, next);
return {
result:"success",
code:200,
errorMessage:"",
data:list
};
case "item":
var id=input.getString('id',"");
var modelCarCategory = model.getInstance("carcategory",1,req, res, next);
var item=await modelCarCategory.getItem(req, res, next,id);
return item;
}
};
}
module.exports = carcategories_json;
Chưa có câu hỏi nào cho bài này.