1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/backend/routes/GalleryRouter.ts

61 lines
1.6 KiB
TypeScript
Raw Normal View History

///<reference path="../../typings/main.d.ts"/>
import {AuthenticationMWs} from "../middlewares/AuthenticationMWs";
2016-03-20 02:59:19 +08:00
import {GalleryMWs} from "../middlewares/GalleryMWs";
import {RenderingMWs} from "../middlewares/RenderingMWs";
export class GalleryRouter{
constructor(private app){
this.addDirectoryList();
this.addGetImageThumbnail();
this.addGetImage();
this.addSearch();
this.addAutoComplete();
}
private addDirectoryList() {
2016-03-26 23:25:48 +08:00
this.app.get(["/api/gallery/:directory","/api/gallery/","/api/gallery//"],
2016-03-20 23:54:30 +08:00
AuthenticationMWs.authenticate,
GalleryMWs.listDirectory,
RenderingMWs.renderResult
);
};
private addGetImage() {
2016-03-20 17:49:49 +08:00
this.app.get(["/api/gallery/:directory/:image","/api/gallery/:image"],
2016-03-20 23:54:30 +08:00
AuthenticationMWs.authenticate,
GalleryMWs.loadImage,
RenderingMWs.renderFile
);
};
private addGetImageThumbnail() {
this.app.get("/api/gallery/:directory/:image/thumbnail",
2016-03-20 02:59:19 +08:00
AuthenticationMWs.authenticate,
GalleryMWs.loadThumbnail,
RenderingMWs.renderFile
);
};
private addSearch() {
this.app.get("/api/gallery/search",
2016-03-20 02:59:19 +08:00
AuthenticationMWs.authenticate,
GalleryMWs.search,
RenderingMWs.renderResult
);
};
private addAutoComplete() {
this.app.get("/api/gallery/autocomplete",
2016-03-20 02:59:19 +08:00
AuthenticationMWs.authenticate,
GalleryMWs.autocomplete,
RenderingMWs.renderResult
);
};
}