當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript express.bodyParser函數代碼示例

本文整理匯總了TypeScript中express.bodyParser函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript bodyParser函數的具體用法?TypeScript bodyParser怎麽用?TypeScript bodyParser使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了bodyParser函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 app.configure(function () {
     app.set('view engine', 'ejs');
     app.engine('.html', engine.renderFile);
     app.use(express.bodyParser());
     app.use(express.methodOverride());
     app.use(express.static('public'));
 });
開發者ID:Semigradsky,項目名稱:Batla,代碼行數:7,代碼來源:server.ts

示例2:

app.configure(function () {
    console.log("app.configure");
    app.use(express.bodyParser());
    app.set('views', __dirname + '/views');
    app.set('view engine', 'ejs');
    app.use(express.static(__dirname + '/public'));
});
開發者ID:acrobat888,項目名稱:NodeJS,代碼行數:7,代碼來源:nockmarket.ts

示例3: intializeWebServer

 private intializeWebServer() {
     this.app = express();
     this.app.use(express.bodyParser());
     this.app.use('/', express.static(__dirname + '/content'));
     this.app.post('/api/signup', this.signup.bind(this));
     this.app.get('/api/:username/:queue', this.getMessages);
     this.app.post('/api/:username/:queue', this.sendMessage);
 }
開發者ID:FlatlinerDOA,項目名稱:OpenQ,代碼行數:8,代碼來源:openq-express.ts

示例4:

app.configure(function () {
    app.use(express.static('public'));
    app.use(express.cookieParser());
    app.use(express.bodyParser());
    app.use(express.session({ secret: 'keyboard cat' }));
    app.use(passport.initialize());
    app.use(passport.session());
    app.use(app.router);
});
開發者ID:dpwolfe,項目名稱:nko4-siecieborowice,代碼行數:9,代碼來源:server.ts

示例5:

app.configure(function () {
    app.use(express.favicon());
    app.use(express.logger());
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(app.router);
    app.use(express.static(path.join(application_root, "public")));
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
開發者ID:Sally-Xu,項目名稱:Fayde.Demo,代碼行數:9,代碼來源:server.ts

示例6:

app.configure(()=>{
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'ejs');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(path.join(__dirname, 'public')));
});
開發者ID:kaipu1224,項目名稱:typescript-express,代碼行數:11,代碼來源:app.ts

示例7:

    app.configure(function () {
        app.use(express.bodyParser());
        app.use(express.static(__dirname + '/public'));

        app.get('/api/todo', routes.getallTodoes);        
        app.get('/api/todo/MetaData', routes.getMetadata);
        app.get('/api/todo/:todoid', routes.getTodoById);
        app.post('/api/todo', routes.saveChanges);

        app.get('/api/faketodo', routes.getallFakeTodoes);
        app.get('/api/faketodo/MetaData', routes.getFakeMetaData);
        app.get('/api/faketodo/:todoid', routes.getFakeTodoById);
        app.post('/api/faketodo', routes.saveFakeChanges);

    });
開發者ID:latticework,項目名稱:proto-ng-breeze-edge,代碼行數:15,代碼來源:server.ts

示例8: express

        pause: pause,
        setupZlapser: setupZlapser,
        snap: snap,
        shutdown: shutdown,
        setScript: setScript
    }

})();


var app = express();
var theServer = http.createServer(app);
var io = require('socket.io').listen(theServer);


app.use(express.bodyParser());
app.post("/data", model.setupZlapser);
app.post("/start", model.start);
app.post("/stop", model.stop);
app.post("/pause", model.pause);
app.post("/resume", model.pause);
app.post("/snap", model.snap);
app.put("/shutdown", model.shutdown);
app.get("/readme.md", (req, res)=> {

    fs.readFile(__dirname + '/readme.md', 'utf-8', function (err, data) {
        if (err) {
            res.send("<p>Error getting readme.md</p>");
        }
        var converter = new pagedown.Converter();
        res.send(")]}',\n" + converter.makeHtml(data));
開發者ID:ziaxdk,項目名稱:zlapser,代碼行數:31,代碼來源:server.ts

示例9: done

                        done(null, results);
                     }
                  },replace);
               }
               else {
                  if (!--pending) {
                     done(null, results);
                  }
               }
            });
         });
      });
   };


   server.use(express.bodyParser());
   server.use(express.cookieParser());
   server.use(express.compress());
   server.get('/', function (req, res) {
      res.render(path.resolve(__dirname, '../app.html'));
   });

   var cachedFiles:any[] = null;
   /**
    * A Quick demo hack for enumerating system files.  Calculate this once and cache it, because
    * it could potentially be an expensive operation, and we'll be running on slow ass free Heroku
    * servers.
    */
   server.get('/files', function (req, res) {
      if(cachedFiles){
         res.json(cachedFiles,200);
開發者ID:justindujardin,項目名稱:pow-edit,代碼行數:31,代碼來源:server.ts

示例10: require

// .These two lines are required to initialize Express in Cloud Code.
var express = require('express');
var app = express();

// .Global app configuration section
app.set('views', 'cloud/views');  // .Specify the folder to find templates
app.set('view engine', 'ejs');    // .Set the template engine
app.use(express.bodyParser());    // .Middleware for reading request body

// .This is an example of hooking up a request handler with a specific request
// path and HTTP verb using the Express routing API.
app.get('/hello', function(req: any, res: any) {
  res.render('hello', { message: 'Congrats, you just set up your app!' });
});

// // Example reading from the request query string of an HTTP get request.
// app.get('/test', function(req, res) {
//   // GET http://example.parseapp.com/test?message=hello
//   res.send(req.query.message);
// });

// // Example reading from the request body of an HTTP post request.
// app.post('/test', function(req, res) {
//   // POST http://example.parseapp.com/test (with request body "message=hello")
//   res.send(req.body.message);
// });

app.get('/post/:objectId', function(req: any, res: any) {

開發者ID:AbeHaruhiko,項目名稱:chavo,代碼行數:28,代碼來源:app.ts


注:本文中的express.bodyParser函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。