本文整理匯總了TypeScript中express.Express.put方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Express.put方法的具體用法?TypeScript Express.put怎麽用?TypeScript Express.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類express.Express
的用法示例。
在下文中一共展示了Express.put方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: addCreateUser
private static addCreateUser(app: Express) {
app.put('/api/user',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
UserMWs.createUser,
RenderingMWs.renderOK
);
}
示例2: defineRoutes
defineRoutes(): void {
this.app.get(RestService.generateRoute(Api.CHARACTERS, CharactersActions.getCharacterById), this.charactersComponent.getCharactersById);
this.app.get(RestService.generateRoute(Api.CHARACTERS, CharactersActions.getCharacters), this.charactersComponent.getCharacters);
this.app.post(RestService.generateRoute(Api.CHARACTERS, CharactersActions.createCharacters), this.charactersComponent.createCharacter);
this.app.put(RestService.generateRoute(Api.CHARACTERS, CharactersActions.updateCharacterById), this.charactersComponent.updateCharacterById);
this.app.delete(RestService.generateRoute(Api.CHARACTERS, CharactersActions.removeCharacterById), this.charactersComponent.removeCharacterById);
this.app.post(RestService.generateRoute(Api.CHARACTERS, CharactersActions.searchCharacters), this.charactersComponent.searchCharacters);
}
示例3: 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);
});
}
示例4: RegisterRoutes
RegisterRoutes()
{
var self = this;
this.app.get('/api/email/getSummary', this.emailController.GetSummary)
this.app.put('/api/email', this.emailController.Create);
this.app.post('/api/email/:id', this.emailController.Update);
this.app.delete('/api/email/:id', this.emailController.Delete);
this.app.get('/api/email', function (req, res) {
// body...
self. onInit();
return self.emailController.GetByQuery(req, res)
});
this.app.get('/api/email/:id', function (req, res) {
// body...
self. onInit();
return self.emailController.GetById(req, res)
});
}
示例5: RegisterRoutes
RegisterRoutes()
{
var self = this;
this.app.put('/api/profile', this.profileController.Create);
this.app.post('/api/profile/:id', this.profileController.Update);
this.app.delete('/api/profile/:id', this.profileController.Delete);
this.app.get('/api/profile', function (req, res) {
// body...
self.onInit();
return self.profileController.GetByQuery(req, res)
});
this.app.get('/api/profile/:id', function (req, res) {
// body...
self.onInit();
return self.profileController.GetById(req, res)
})
}
示例6: addSettings
private static addSettings(app: Express) {
app.get('/api/settings',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
RenderingMWs.renderConfig
);
app.put('/api/settings/database',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateDatabaseSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/map',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateMapSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/video',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateVideoSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/metafile',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateMetaFileSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/authentication',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateAuthenticationSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/thumbnail',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateThumbnailSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/search',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateSearchSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/share',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateShareSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/randomPhoto',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateRandomPhotoSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/basic',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateBasicSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/other',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateOtherSettings,
RenderingMWs.renderOK
);
app.put('/api/settings/indexing',
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.Admin),
AdminMWs.updateIndexingSettings,
RenderingMWs.renderOK
);
}
示例7: registerRoutes
export function registerRoutes(app: Express) {
// My kingdom for a function composition operator
const canUserReserve = middlewarify(Capabilities.Lodging.canUserReserveAP);
const canExternalReserve = middlewarify(Capabilities.Lodging.canExternalReserveAP);
const isOwnerOf = middlewarify(Capabilities.Lodging.isOwnerOfAP);
const canPostLodgings = middlewarify(Capabilities.Lodging.canPostAP);
const canAccessReservation = middlewarify(Capabilities.Reservation.canAccessAP);
const canManipulateAmenities = middlewarify(Capabilities.Amenities.canManipulateAP);
const canAccessUser = middlewarify(Capabilities.User.canAccessUserAP);
app.get("/", Index.get);
app.get("/login", Login.get);
app.get("/register", Register.get);
app.get("/me", isLoggedIn, Me.get);
app.get("/user/:id", canAccessUser, User.get);
app.get("/users", middlewarify(promisify(Role.isAdminP)), Users.get);
app.get("/seller_application", SellerApplication.get);
app.get("/lodgings", Lodgings.get);
app.get("/lodgings/new", canPostLodgings, NewLodging.get);
app.get("/lodgings/:id/reservations/user/new", canUserReserve, NewUserReservation.get);
app.get("/lodgings/:id/reservations/external/new", canExternalReserve, NewExternalReservation.get);
app.get("/lodgings/:id/reservations", isOwnerOf, LodgingReservations.get);
app.get("/lodgings/:id", Lodging.get);
app.get("/lodgings/:id/edit", isOwnerOf, EditLodging.get);
app.get("/my_lodgings", canPostLodgings, MyLodgings.get);
app.get("/my_reservations", isLoggedIn, MyReservations.get);
app.get("/reservations/:id", canAccessReservation, Reservation.get);
app.get("/mock/payment_provider/:id", canAccessReservation, PaymentProvider.get);
// NOT SECURED. In a real-world system this would use access tokens and domain whitelisting.
app.post("/api/v1/mock/payment_callback", isLoggedIn, PaymentCallbackApi.post);
app.get("/amenities", canManipulateAmenities, Amenities.get);
app.post("/api/v1/login", LoginApi.post);
app.post("/api/v1/logout", isLoggedIn, LogoutApi.post);
app.get("/api/v1/my_lodgings", canPostLodgings, MyLodgingsApi.get);
app.get("/api/v1/lodgings", LodgingSearchApi.get);
app.post("/api/v1/lodgings/new", canPostLodgings, NewLodgingApi.post);
// These two routes handle their own access control
app.post("/api/v1/reservations/user", NewUserReservationApi.post);
app.post("/api/v1/reservations/external", NewExternalReservationApi.post);
app.get("/api/v1/lodgings/:id/reservations/bounds", ReservationBoundsApi.get);
app.post("/api/v1/lodgings/:id/publish", isOwnerOf, PublishLodgingApi.post);
app.post("/api/v1/lodgings/:id/unpublish", isOwnerOf, UnpublishLodgingApi.post);
app.put("/api/v1/lodgings/:id", isOwnerOf, LodgingApi.put);
app.get("/api/v1/lodgings/:id", isOwnerOf, LodgingApi.get);
app.get("/api/v1/amenities", AmenitiesApi.get);
app.post("/api/v1/amenities", canManipulateAmenities, AmenitiesApi.post);
app.delete("/api/v1/amenities/:id", canManipulateAmenities, AmenitiesApi.delete);
app.put("/api/v1/amenities/:id", canManipulateAmenities, AmenitiesApi.put);
app.get("/api/v1/users/:email/available", EmailAvailableApi.get);
app.post("/api/v1/users", NewUserApi.post);
app.post("/api/v1/seller_application", isLoggedIn, NewSellerApplicationApi.post);
app.post("/api/v1/users/:id/approve_application", middlewarify(promisify(Role.isAdminP)), ApproveApplicationApi.post);
}
示例8: defineRoutes
defineRoutes(): void {
this.app.get(RestService.generateRoute(Api.USERS, UsersActions.getUserById), this.usersComponent.getUserById);
this.app.post(RestService.generateRoute(Api.USERS, UsersActions.createUser), this.usersComponent.createUser);
this.app.put(RestService.generateRoute(Api.USERS, UsersActions.updateUserById), this.usersComponent.updateUserById);
this.app.delete(RestService.generateRoute(Api.USERS, UsersActions.deleteUserById), this.usersComponent.deleteUserById);
}