本文整理汇总了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);
});
}