当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript check.check函数代码示例

本文整理汇总了TypeScript中express-validator/check.check函数的典型用法代码示例。如果您正苦于以下问题:TypeScript check函数的具体用法?TypeScript check怎么用?TypeScript check使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: check

  getOrderWithDetails,
  updateOrder
} from '../data/orders';
import { getAllProducts } from '../data/products';
import { getAllRegions } from '../data/regions';
import { getAllShippers } from '../data/shippers';

const router = express.Router();

/**
 * A set of validations to apply for the "create order" (POST /order) request.
 * These ensure that informative error messages are generated in the event that
 * any required properties are missing, they're of the wrong types, etc...
 */
const CREATE_ORDER_VALIDATIONS = [
  check('employeeid')
    .exists()
    .isNumeric()
    .toInt(),
  check('customerid')
    .exists()
    .isAlphanumeric()
    .trim(),
  check('shipcity')
    .exists()
    .trim(),
  check('shipaddress')
    .exists()
    .trim(),
  check('shipname')
    .exists()
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:31,代码来源:orders.ts

示例2: async

router.get('/', async (req, res, next) => {
  try {
    let { filter = '' } = req.query || {};
    let customers = await getAllCustomers({ filter }); // * get the data
    res.render('customers', { customers, filter });
  } catch (e) {
    next(e);
  }
});

/**
 * Handle the HTTP request an individual Customer
 */
router.get(
  '/:id',
  [check('id')],
  async (req: express.Request, res: express.Response, next: express.NextFunction) => {
    try {
      let { page = 1, perPage = 30, sort, order } = req.query;
      let id = req.params.id;
      let customer = await getCustomer(id); // * get the data
      let orders = await getCustomerOrders(id, { page, perPage, sort, order }); // * get the data
      res.render('customers/show', { customer, orders, page });
    } catch (e) {
      next(e);
    }
  }
);

export default router;
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:30,代码来源:customers.ts

示例3: timeline

 private timeline() {
   this.router.get('/timeline', [check(['range', 'start', 'end'])],
     EndpointController.timeline.bind(EndpointController));
 }
开发者ID:braxtondiggs,项目名称:Wartortle,代码行数:4,代码来源:index.ts

示例4: index

 private index() {
   this.router.get('/', [check(['range', 'start', 'end'])],
     EndpointController.all.bind(EndpointController));
 }
开发者ID:braxtondiggs,项目名称:Wartortle,代码行数:4,代码来源:index.ts

示例5: projects

 private projects() {
   this.router.get('/projects', [check(['range', 'start', 'end'])],
     EndpointController.projects.bind(EndpointController));
 }
开发者ID:braxtondiggs,项目名称:Wartortle,代码行数:4,代码来源:index.ts

示例6: languages

 private languages() {
   this.router.get('/languages', [check(['range', 'start', 'end'])],
     EndpointController.languages.bind(EndpointController));
 }
开发者ID:braxtondiggs,项目名称:Wartortle,代码行数:4,代码来源:index.ts

示例7: editors

 private editors() {
   this.router.get('/editors', [check(['range', 'start', 'end'])],
     EndpointController.editors.bind(EndpointController));
 }
开发者ID:braxtondiggs,项目名称:Wartortle,代码行数:4,代码来源:index.ts

示例8: switch

};

export const isImage = (path: string): boolean => {
			const position = path.lastIndexOf('.');
			if (position < 1) { return false; }
			switch (path.slice(position + 1).toLowerCase()) {
				case 'jpg': return true;
				case 'jpeg': return true;
				case 'png': return true;
				case 'tiff': return true;
				default: return false;
			}
};

export const vInitiateXEMPurchase = [
	check(KEY_PRODUCT_ID)
		.exists()
		.trim()
		.custom(validateProduct),
	check(KEY_TOKEN_RECIPIENT_ADDRESS)
		.exists()
		.trim()
		.custom(validateTokenAddress)
		.withMessage(`${DATA_ERR_BY.MISSING_PARAMS}: ${KEY_TOKEN_RECIPIENT_ADDRESS}`),
	check(KEY_TOKEN_TYPE)
		.exists()
		.trim()
		.custom(validateTokenType),
	errorHandler
];
开发者ID:joseabril25,项目名称:nem-coinbase-token-sale-api,代码行数:30,代码来源:validators.ts

示例9: check

  inventory: 'needs-reorder' | 'discontinued';
  requiredTags: string[];
  flavor: ProductFlavorFilter[];
}

import {
  getAllProducts,
  getProduct,
  getProductPricingHistory,
  updateProduct
} from '../data/products';

const router = express.Router();

const ALL_PRODUCTS_VALIDATORS = [
  check('flav').isWhitelisted(['sweet-hot', 'refreshing', 'sweet-sour']),
  check('inventory').isLowercase(),
  check('tags').isLowercase()
];

const UPDATE_PRODUCT_VALIDATORS = [
  check('metadata.flavor.sweet')
    .exists()
    .isNumeric()
    .toInt(),
  check('metadata.flavor.salty')
    .exists()
    .isNumeric()
    .toInt(),
  check('metadata.flavor.spicy')
    .exists()
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:31,代码来源:products.ts


注:本文中的express-validator/check.check函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。