2016-03-20 00:31:42 +08:00
|
|
|
///<reference path="../../typings/main.d.ts"/>
|
|
|
|
|
|
|
|
import {AuthenticationMWs} from "../middlewares/AuthenticationMWs";
|
2016-03-20 02:59:19 +08:00
|
|
|
import {GalleryMWs} from "../middlewares/GalleryMWs";
|
2016-03-20 00:31:42 +08:00
|
|
|
|
|
|
|
export class GalleryRouter{
|
|
|
|
constructor(private app){
|
|
|
|
|
|
|
|
this.addDirectoryList();
|
|
|
|
this.addGetImageThumbnail();
|
|
|
|
this.addGetImage();
|
|
|
|
|
|
|
|
this.addSearch();
|
|
|
|
this.addAutoComplete();
|
|
|
|
}
|
|
|
|
|
|
|
|
private addDirectoryList() {
|
|
|
|
this.app.get("/api/gallery/:directory",
|
2016-03-20 02:59:19 +08:00
|
|
|
AuthenticationMWs.authenticate,
|
|
|
|
GalleryMWs.listDirectory
|
2016-03-20 00:31:42 +08:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private addGetImage() {
|
|
|
|
this.app.get("/api/gallery/:directory/:image",
|
2016-03-20 02:59:19 +08:00
|
|
|
AuthenticationMWs.authenticate,
|
|
|
|
GalleryMWs.renderImage
|
2016-03-20 00:31:42 +08:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
private addGetImageThumbnail() {
|
|
|
|
this.app.get("/api/gallery/:directory/:image/thumbnail",
|
2016-03-20 02:59:19 +08:00
|
|
|
AuthenticationMWs.authenticate,
|
|
|
|
GalleryMWs.renderThumbnail
|
2016-03-20 00:31:42 +08:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
private addSearch() {
|
|
|
|
this.app.get("/api/gallery/search",
|
2016-03-20 02:59:19 +08:00
|
|
|
AuthenticationMWs.authenticate,
|
|
|
|
GalleryMWs.search
|
2016-03-20 00:31:42 +08:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
private addAutoComplete() {
|
|
|
|
this.app.get("/api/gallery/autocomplete",
|
2016-03-20 02:59:19 +08:00
|
|
|
AuthenticationMWs.authenticate,
|
|
|
|
GalleryMWs.autocomplete
|
2016-03-20 00:31:42 +08:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|