本文整理匯總了TypeScript中express.Express.all方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Express.all方法的具體用法?TypeScript Express.all怎麽用?TypeScript Express.all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類express.Express
的用法示例。
在下文中一共展示了Express.all方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: setup
export function setup(app: Express) {
app.post('/api/auth', handlers.auth);
app.all('/api/*', passportHelper.ensureAuthenticated);
app.get('/api/user/get/:user_id?', handlers.user.getById);
app.get('/api/users/find(/:search_query?(/:page?)?)?', handlers.users.find);
app.get('/api/users/find//:page', handlers.users.find);
app.get('/api/friendships/getAll', handlers.friendships.getAll);
app.post('/api/friendship/request/:user_id', handlers.friendship.request);
app.post('/api/friendship/accept/:friendship_id', handlers.friendship.accept);
app.post('/api/friendship/decline/:friendship_id', handlers.friendship.decline);
}
示例2: function
app.get('/apidocs', function(req:express.Request, res:express.Response){
res.sendFile('index.html',{ 'root':path.resolve(WWW + '/apidocs/')});
});
app.use(function(req:Request, res:Response, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.all('/proxy/*', function(req: express.Request, res:express.Response) {
var proxyURL = "http://digitalsignage.front-desk.ca/" ;
req.url = req.url.substr(6);
var options = {target : proxyURL};
proxy.web(req, res, options);
});
const port:number = process.env.PORT || 56777;
// app.use('/api/users', require('./server/users/index'));
// app.use('/api/user', require('./server/users/user'));
app.use('/api/content', require('./server/content/manager'));
app.use('/api/assets', require('./server/assets/manager'));
app.use('/api/playlists', require('./server/playlists/manager'));
app.use('/api/messages', require('./server/message/manager'));
var rss = require('./server/libs/rss');
app.get('/api/rss/:id',function(req: express.Request, res:express.Response){