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

TypeScript method-override.default函数代码示例

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

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



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

示例1: require

    $onMountingMiddlewares(): void|Promise<any> {
        const morgan = require('morgan'),
            cookieParser = require('cookie-parser'),
            bodyParser = require('body-parser'),
            compress = require('compression'),
            methodOverride = require('method-override');


        this
            .use(morgan('dev'))
            .use(ServerLoader.AcceptMime("application/json"))

            .use(cookieParser())
            .use(compress({}))
            .use(methodOverride())
            .use(bodyParser.json())
            .use(bodyParser.urlencoded({
                extended: true
            }));

        let asyncPromises = this.mqttServer
            .then((server : any) => server.attachHttpServer(this.httpServer));

        return asyncPromises;
    }
开发者ID:PiStation,项目名称:pistation-api,代码行数:25,代码来源:server.ts


示例2: require

  /**
   * This method let you configure the middleware required by your application to works.
   * @returns {Server}
   */
  public $onMountingMiddlewares(): void {
    const cookieParser = require("cookie-parser"),
      bodyParser = require("body-parser"),
      compress = require("compression"),
      methodOverride = require("method-override"),
      expressSession = require("express-session");

    this.use(TestAcceptMimeMiddleware)
      .use(bodyParser.json())
      .use(
        bodyParser.urlencoded({
          extended: true
        })
      )
      .use(cookieParser())
      .use(compress({}))
      .use(methodOverride());

    this.engine(".html", require("ejs").__express)
      .set("views", `${rootDir}/views`)
      .set("view engine", "html");

    this.set("trust proxy", 1);
    this.use(
      expressSession({
        secret: "keyboard cat",
        resave: false,
        saveUninitialized: true,
        cookie: {}
      })
    );

    this.use(InitSessionMiddleware);
  }
开发者ID:Romakita,项目名称:ts-express-decorators,代码行数:38,代码来源:app.ts


示例3:

  $onMountingMiddlewares(): void | Promise<any> {
    this
      .use(GlobalAcceptMimesMiddleware)
      .use(cookieParser())
      .use(compress({}))
      .use(methodOverride())
      .use(bodyParser.json())
      .use(bodyParser.urlencoded({
        extended: true
      }))
      .use(session({
        secret: "mysecretkey",
        resave: true,
        saveUninitialized: true,
        maxAge: 36000,
        cookie: {
          path: "/",
          httpOnly: true,
          secure: false,
          maxAge: null
        }
      }));

    return null;
  }
开发者ID:Romakita,项目名称:ts-express-decorators,代码行数:25,代码来源:Server.ts


示例4:

 $onMountingMiddlewares() {
   this
     .use(GlobalAcceptMimesMiddleware)
     .use(methodOverride())
     .use(bodyParser.json())
     .use(bodyParser.urlencoded({
       extended: true
     }));
 }
开发者ID:Romakita,项目名称:ts-express-decorators,代码行数:9,代码来源:Server.ts


示例5:

  /**
   * This method let you configure the middleware required by your application to works.
   * @returns {Server}
   */
  $onMountingMiddlewares(): void | Promise<any> {
    this
      .use(GlobalAcceptMimesMiddleware)
      .use(cookieParser())
      .use(compress({}))
      .use(methodOverride())
      .use(bodyParser.json())
      .use(bodyParser.urlencoded({
        extended: true
      }));

    return null;
  }
开发者ID:Romakita,项目名称:ts-express-decorators,代码行数:17,代码来源:Server.ts


示例6: require

  /**
   * This method let you configure the middleware required by your application to works.
   * @returns {Server}
   */
  public $onMountingMiddlewares(): void {
    const cookieParser = require("cookie-parser"),
      bodyParser = require("body-parser"),
      compress = require("compression"),
      methodOverride = require("method-override");

    this.use(GlobalAcceptMimesMiddleware)
      .use(bodyParser.json())
      .use(
        bodyParser.urlencoded({
          extended: true
        })
      )
      .use(cookieParser())
      .use(compress({}))
      .use(methodOverride());

    this.engine(".html", require("ejs").__express)
      .set("views", `${rootDir}/views`)
      .set("view engine", "html");
  }
开发者ID:Romakita,项目名称:ts-express-decorators,代码行数:25,代码来源:FakeServer.ts


示例7: ready

    ready() {
        this.port = process.env.PORT || 8080;
        this.listenCallback = () => {
            console.log("App listening on port " + this.port);
        };

        mongoose.connect(database.localUrl); // Connect to local MongoDB instance. A remoteUrl is also available (modulus.io)

        // set the static files location /public/img will be /img for users
        this.setStatic = (app, express) => {
            app.use(express.static(pathModule.resolve(__dirname, '../client')));
        };

        this.morgan = morgan('dev'); // log every request to the console
        this.bodyParserURL = bodyParser.urlencoded({'extended': 'true'}); // parse application/x-www-form-urlencoded
        this.bodyParserJSON = bodyParser.json(); // parse application/json
        this.bodyParserCustom = bodyParser.json({type: 'application/vnd.api+json'}); // parse application/vnd.api+json as json
        this.methodOverride = methodOverride('X-HTTP-Method-Override'); // override with the X-HTTP-Method-Override header in the request

        this.appHandler = (req, res) => {
            res.sendFile(pathModule.resolve(__dirname, '../client/index.html')); // load the single view file (angular will handle the page changes on the front-end)
        };
    }
开发者ID:scramjs,项目名称:node-todo,代码行数:23,代码来源:app.component.ts


示例8: require

    passphrase: 'knum5728xw'
};
var c = require('./routes/conf');

var app = module.exports = express();

app.set('port', process.env.PORT || 1337);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(favicon(__dirname + '/public/images/favicon.ico'));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
    extended: true
}));
app.use(methodOverride());
app.use(cookieParser('Ikmezicke683iskow'));
app.use(session({
    resave: true,
    saveUninitialized: true,
    secret: 'keyboard cat',
    //cookie: { secure: true } //?invalid csrf token?
}));
var sessionCheck = function(req, res, next) {
    if (req.session.login === true) {
        next();
    } else {
        res.redirect('/login');
    }
};
app.use(express.static(__dirname + '/public'));
开发者ID:KoichiHirahata,项目名称:FindingsSite,代码行数:31,代码来源:server.ts


示例9: require

// Connect/Express middleware
var body_parser = require('body-parser');
var compression = require('compression');
var errorhandler = require('errorhandler');
var method_override = require('method-override');

var app = express();

// Settings
app.set('views', __dirname + '/views');
app.set('view engine', 'vash');

// Configuration
app.use(compression());
app.use(body_parser());
app.use(method_override());

// Routes
routes.setupRoutes(app);

// Catch All
app.use(express.static(__dirname + '/public'));
app.use(function (req: express.Request, res: express.Response, next) {
    res.status(404);
    if (req.accepts('html')) {
        res.render('_shared/404');
        return;
    }
    if (req.accepts('json')) {
        res.send({ error: 'Not found' });
        return;
开发者ID:irysius,项目名称:NodeSiteTemplate,代码行数:31,代码来源:app.ts


示例10: require

var mongoose = require('mongoose');
var morgan = require('morgan');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');


//mongoose.connect('mongodb://localhost/tododb');
mongoose.connect("mongodb://biloko:[email protected]:15508/edo_db1");

app.use(express.static(__dirname + '/public'));
app.use(express.static(__dirname + '/public/images'));
app.use(morgan('dev')); // log every request to the console
app.use(bodyParser.urlencoded({'extended': 'true'})); // parse application/x-www-form-urlencoded
app.use(bodyParser.json()); // parse application/json
app.use(bodyParser.json({type: 'application/vnd.api+json'})); // parse application/vnd.api+json as json
app.use(methodOverride('X-HTTP-Method-Override')); // override

var port = 8080;

module.exports = app;

todo = mongoose.model("todo", { tekst: String, korisnik_id: String});
korisnik = mongoose.model("korisnik", { username: String, password: String, profilna: Buffer});

require("./rutiranje")(app);

app.get('/bower_components/angular-xeditable/dist/css/xeditable.css', function(req, res, next)
{
  return res.sendFile("bower_components/angular-xeditable/dist/css/xeditable.css");
});
开发者ID:edoimamovic,项目名称:Todo-web-app,代码行数:30,代码来源:app.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript index.MetricsCollector类代码示例发布时间:2022-05-25
下一篇:
TypeScript tracker.Tracker.Dependency类代码示例发布时间: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