• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript root-path.default函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: require

/// <reference path="../../typings/tsd.d.ts" />

var root = require('root-path');
var metadata = require(root('/server/db/meta'));
var breeze_sequel = require(root('/server/breeze_sequel/main'));
import breeze = require('breeze-client');

import _ = require('lodash');

var DT = breeze.DataType;
var Identity = breeze.AutoGeneratedKeyType.Identity;
var Validator = breeze.Validator;
var camelCaseConvention: breeze.NamingConvention = breeze.NamingConvention.none;

// Breeze Labs: breeze.metadata.helper.js
var helper = new breeze_sequel.breeze.config.MetadataHelper();

// Helper convenience methods
var addDataService = helper.addDataService.bind(helper);
var addTypeToStore = helper.addTypeToStore.bind(helper);
var setDefaultNamespace = helper.setDefaultNamespace.bind(helper);

var dataNameSpace = 'afrikNetMarket';

export interface DataProperty {
    [name: string]: DataPropertyDefinition
}

export interface DataPropertyDefinition {
    dataType?: breeze.DataTypeSymbol;
    defaultValue?: any;
开发者ID:afriknet,项目名称:umarket,代码行数:31,代码来源:store.ts


示例2: load_apis

function load_apis(context: ctx.AppContext) {

    var files: string[] = fs.readdirSync(root('/api/controllers'));

    _.each(files, fn => {
        
        var ext = path.extname(fn);

        if (ext === '.js') {

            var _skip_file = _.find(skip_files, f => {
                return f === fn;
            }) != undefined;


            if (!_skip_file) {

                var _api = require(root('/api/controllers/' + fn));

                _api(context);

            }            
        }
    });
}
开发者ID:afriknet,项目名称:umarket,代码行数:25,代码来源:init.ts


示例3: require

    _.each(files.sort(), fn => {

        var ext = path.extname(fn);

        if (ext === '.js') {

            var model = require(root('/api/models/' + fn));

            if (_.isFunction(model)) {
                model();
            }
            
        }
    });
开发者ID:afriknet,项目名称:umarket,代码行数:14,代码来源:init.ts


示例4: upload_file

export function upload_file(req: Express.Request, res: Express.Response) {

    var options = {
        dirname: root('/assets/images'),
        saveAs: (__newFileStream, cb) => {
            cb(null, path.basename(__newFileStream.filename));
        }
    };
    

    (req as any)['file']('file').upload(options, function (err, files:any[]) {

        if (err) {
            console.log('error');
        }
        else {
            console.log(files);
        }

        var path = files[0].fd;

        base64.base64(path, (err, data) => {

            var product_id = req.params['product_id'];

            var params = '/products/' + product_id + '/images?file[data][$binary]=' + data;

            sch_client['post'](params, (err, result) => {


            });

            /*

            sch_client[info.fn].apply(sch_client, params);

            POST /products/<id>/images?file[data][$binary]=<base64 encoded image data>&caption=<optional caption>
            */

        });

        res.send(files[0]);
    });
}
开发者ID:afriknet,项目名称:umarket.node,代码行数:44,代码来源:dispatch.ts


示例5: load_models

function load_models(context: ctx.AppContext) {
    
    var files: string[] = fs.readdirSync(root('/api/models'));

    _.each(files.sort(), fn => {

        var ext = path.extname(fn);

        if (ext === '.js') {

            var model = require(root('/api/models/' + fn));

            if (_.isFunction(model)) {
                model();
            }
            
        }
    });
    
}
开发者ID:afriknet,项目名称:umarket,代码行数:20,代码来源:init.ts


示例6: function

export var upload_file = function (req: express.Request, res: express.Response, next) {
    
    var uploadOptions = {

        dirname: root('/assets/images'),

        saveAs: function (__newFileStream, cb) {
            cb(null, path.basename(__newFileStream.filename));
        },                
    }

    req['file']('file').upload(uploadOptions, function (err, files) {

        if (err) {
            console.log('error');
        }
        else {
            console.log(files);
        }
        
        res.send(files[0]);
    });
}
开发者ID:afriknet,项目名称:umarket,代码行数:23,代码来源:fileupload.ts


示例7: require


/// <reference path="../appcontext.ts" />
/// <reference path="../../typings/tsd.d.ts" />
/// <reference path="utils.ts" />
/// <reference path="adapter.ts" />
/// <reference path="store.ts" />

var root = require('root-path');
import ctx = require('../appcontext');
import Q = require('q');
var br_sequel = require( root('/server/breeze_sequel/main'));
var sequel_manager = br_sequel.SequelizeManager;
var sequel_query = br_sequel.SequelizeQuery;
var sequel_save = br_sequel.SequelizeSaveHandler;
var __sequel = require('sequelize');
import utils = require('./utils');
import _ = require('lodash');
import Store = require('./store');
import breeze = require('breeze-client');
require('./adapter');


br_sequel.breeze.config.initializeAdapterInstance('dataService', 'adapter_webApi', true);


export interface ApiInfo {
    serviceName: string,
    getInstance: (ctx: ctx.AppContext) => ServiceApi
}

开发者ID:afriknet,项目名称:umarket,代码行数:29,代码来源:serviceapi.ts


示例8: start_db

/// <reference path="../../typings/tsd.d.ts" />

/// <reference path="../../typings/express/express.d.ts" />


var root = require('root-path');
import path = require('path');
var fs = require('fs');

//import breeze = require('breeze-client');

var bs = require(root('/server/breeze_sequel/main'));
var s_mgr = bs.SequelizeManager;

//var s_qury = bs.SequelizeQuery;
//var s_shandle = bs.SequelizeSaveHandler
//var squlz = require('sequelize'); 
//require('./adapter');
//bs.breeze.config.initializeAdapterInstance('dataService', 'adapter_webApi', true);

var Con = require(root('/config/connections'));
var dbconn = Con.connections.dbconnection;

export function start_db(app: Express.Application) {
    
    var conn = new s_mgr(dbconn.config, dbconn.extra);
    
    //conn.sequelize.query("select top 10 * from occp", { type: squlz.QueryTypes.SELECT }).then(list => {
    //    var d = list;
    //});
开发者ID:afriknet,项目名称:umarket,代码行数:30,代码来源:boot.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript seed.Task类代码示例发布时间:2022-05-25
下一篇:
TypeScript rollup-pluginutils.createFilter函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap