上一页 1 ··· 111 112 113 114 115 116 117 118 119 ··· 492 下一页
摘要: CrudController: 查看代码 export const getOne = model => async (req, res) => { try { const doc = model .findOne({ createdBy: req.user._id, _id: req.params. 阅读全文
posted @ 2022-08-23 19:25 Zhentiw 阅读(29) 评论(0) 推荐(0)
摘要: Each model controller: import { crudControllers } from '../../utils/crud' import { Item } from './item.model' export default crudControllers(Item) You 阅读全文
posted @ 2022-08-23 19:23 Zhentiw 阅读(20) 评论(0) 推荐(0)
摘要: Model: import mongoose from 'mongoose' const itemSchema = new mongoose.Schema( { name: { type: String, required: true, trim: true, maxlength: 50 }, st 阅读全文
posted @ 2022-08-23 19:20 Zhentiw 阅读(18) 评论(0) 推荐(0)
摘要: Model: import mongoose from 'mongoose' const itemSchema = new mongoose.Schema( { name: { type: String, required: true, trim: true, maxlength: 50 }, st 阅读全文
posted @ 2022-08-22 21:00 Zhentiw 阅读(22) 评论(0) 推荐(0)
摘要: Example 1: import mongoose from 'mongoose' const itemSchema = new mongoose.Schema( { name: { type: String, required: true, trim: true, maxlength: 50 } 阅读全文
posted @ 2022-08-22 19:23 Zhentiw 阅读(55) 评论(0) 推荐(0)
摘要: server.js: import itemRouter from './resources/item/item.router' export const app = express() app.use('/api/item', itemRouter) item.router.js import { 阅读全文
posted @ 2022-08-22 19:14 Zhentiw 阅读(16) 评论(0) 推荐(0)
摘要: In VSCode, install REST Clinet Extension: Create API_EXAMPLE.http file in root folder: ### Get mock GET http://localhost:3000/data HTTP/1.1 ### Post m 阅读全文
posted @ 2022-08-22 17:51 Zhentiw 阅读(32) 评论(0) 推荐(0)
摘要: type Corner = `${'top' | 'bottom'} - ${'left' | 'right'}` type Corner = Capitalize<`${'top' | 'bottom'} - ${'left' | 'right'}`> // "Top - left" | "Top 阅读全文
posted @ 2022-08-22 16:01 Zhentiw 阅读(31) 评论(0) 推荐(0)
摘要: V3: type JSONValue = | string | number | boolean | null | JSONArray | JSONObject; type JSONArray = JSONValue[]; type JSONObect = { [k: string]: JSONVa 阅读全文
posted @ 2022-08-22 15:55 Zhentiw 阅读(28) 评论(0) 推荐(0)
摘要: Let's see the unlabelled tuple type: type Address = [ number, string, string, number, ] function printAddress(...address: Address) { console.log(addre 阅读全文
posted @ 2022-08-22 15:03 Zhentiw 阅读(21) 评论(0) 推荐(0)
上一页 1 ··· 111 112 113 114 115 116 117 118 119 ··· 492 下一页