1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-08 13:06:15 +02:00
joplin/packages/server/src/routes/index/home.ts
2020-12-28 11:48:47 +00:00

22 lines
555 B
TypeScript

import { SubPath, Route } from '../../utils/routeUtils';
import { AppContext } from '../../utils/types';
import { contextSessionId } from '../../utils/requestUtils';
import { ErrorMethodNotAllowed } from '../../utils/errors';
const route: Route = {
exec: async function(_path: SubPath, ctx: AppContext) {
const sessionId = contextSessionId(ctx);
const homeController = ctx.controllers.indexHome();
if (ctx.method === 'GET') {
return homeController.getIndex(sessionId);
}
throw new ErrorMethodNotAllowed();
},
};
export default route;