上一页 1 ··· 118 119 120 121 122 123 124 125 126 ··· 477 下一页
摘要: Module pattern provide a way to have both public and private pieces with the export keyword. This protects values from leaking into the global scope o 阅读全文
posted @ 2022-08-26 15:18 Zhentiw 阅读(62) 评论(0) 推荐(0)
摘要: import type only imports declarations to be used for type annotations and declarations. It always gets fully erased, so there’s no remnant of it at ru 阅读全文
posted @ 2022-08-24 14:44 Zhentiw 阅读(112) 评论(0) 推荐(0)
摘要: function isError(err: any): err is Error { return err instanceof Error; } try { somethingRisky() } catch(err: unknown) { if (isError(err)) { console.l 阅读全文
posted @ 2022-08-24 14:23 Zhentiw 阅读(43) 评论(0) 推荐(0)
摘要: In some ways // @ts-expect-error can act as a suppression comment, similar to // @ts-ignore. The difference is that // @ts-ignore will do nothing if t 阅读全文
posted @ 2022-08-24 01:46 Zhentiw 阅读(586) 评论(0) 推荐(0)
摘要: 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 阅读(47) 评论(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 阅读(47) 评论(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 阅读(38) 评论(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 阅读(49) 评论(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 阅读(65) 评论(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 阅读(33) 评论(0) 推荐(0)
上一页 1 ··· 118 119 120 121 122 123 124 125 126 ··· 477 下一页