何时使用猫鼬静态函数?

时间:2019-09-26 16:40:51

标签: node.js mongoose mongoose-schema

我发现有些只使用猫鼬的Schema.statics并将所有逻辑(包括远程API请求)放在那儿,有些使用控制器方法而不使用静态。像下面这样在<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> <div class="container"> <h2>Filterable List</h2> <p>Type something in the input field to search the list for specific items:</p> <input class="form-control" id="myInput" type="text" placeholder="Search.."> <br> <ul class="list-group" id="myList"> <li class="list-group-item">First item</li> <li class="list-group-item">Second item</li> <li class="list-group-item">Third item</li> <li class="list-group-item">Fourth</li> </ul> </div>中结合两者是否正确:

./controllers/user.js

瘦控制器范例矛盾吗?

0 个答案:

没有答案