# 新建/application/models/article.js ``` var tools = require('../../libs/tools'); var config = require(tools.rootPath + 'config'); var { connection, pool, model } = require(tools.rootPath + 'libs/model'); module.exports = class { demo() { return 'demo'; } } ``` # 在/application/controllers/article.js中调用 ``` async test(req, res) { //实例化model let article_model = tools.model('article'); //调用并打印demo方法 this.p(article_model.demo()); } ``` # 浏览器显示 ![](https://img.kancloud.cn/6e/fe/6efe5c925bc6bda35eb5637cab939167_450x169.png) # 控制台显示 ![](https://img.kancloud.cn/8f/08/8f0809bce90212d8062992a2b8147bb2_361x92.png)