本文整理匯總了TypeScript中express.Express類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Express類的具體用法?TypeScript Express怎麽用?TypeScript Express使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Express類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: init
export function init(app: Express) {
// Rutas de acceso a mascotas
app
.route("/image")
.post(passport.authenticate("jwt", { session: false }), image.validateCreate, image.create);
app
.route("/image/:imageId")
.get(image.findByID, image.read);
}
示例2: bootstrap
public static bootstrap(app:Express)
{
console.log("=> Bootstrapping application...");
// Configure express middlewares
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(cookieParser());
app.use(cors(Config.current.cors));
// Setup routes
RoutesConfig.init(app);
}
示例3: constructor
constructor(app : Express)
{
app.get('/', function(req, res) {
res.render('views/index');
});
app.get('/home', function(req, res) {
res.render('views/index');
});
app.get('/aboutUs', function(req, res) {
res.render('views/about');
});
}
示例4: addLogin
private static addLogin(app: Express) {
app.post('/api/user/login',
AuthenticationMWs.inverseAuthenticate,
AuthenticationMWs.login,
RenderingMWs.renderSessionUser
);
}
示例5: addCreateUser
private static addCreateUser(app: Express) {
app.put('/api/user',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
UserMWs.createUser,
RenderingMWs.renderOK
);
}
示例6: addChangePassword
private static addChangePassword(app: Express) {
app.post('/api/user/:id/password',
AuthenticationMWs.authenticate,
UserRequestConstrainsMWs.forceSelfRequest,
UserMWs.changePassword,
RenderingMWs.renderOK
);
}
示例7: RegisterRoutes
RegisterRoutes()
{
var self = this;
this.app.put('/api/user', this.userController.Create);
this.app.post('/api/user/:id', this.userController.Update);
this.app.delete('/api/user/:id', this.userController.Delete);
this.app.get('/api/user', function(req, res){
self.onInit();
return self.userController.GetByQuery(req, res);
});
this.app.get('/api/user/:id', function(req, res){
self.onInit();
return self.userController.GetById(req, res);
});
}