mirror of
https://github.com/DCsunset/taskwarrior-webui.git
synced 2025-08-18 21:43:06 +02:00
feat(backend): add sync at backend
This commit is contained in:
parent
98b4e8be81
commit
b62255f928
2 changed files with 15 additions and 0 deletions
|
@ -5,6 +5,7 @@ import * as logger from 'koa-logger';
|
|||
import * as qs from 'koa-qs';
|
||||
|
||||
import tasksRouter from './tasks';
|
||||
import syncRouter from './sync';
|
||||
import { TaskError } from 'taskwarrior-lib';
|
||||
|
||||
const app = new Koa();
|
||||
|
@ -28,6 +29,7 @@ app.use(async (ctx, next) => {
|
|||
|
||||
const router = new Router();
|
||||
router.use('/tasks', tasksRouter.routes());
|
||||
router.use('/sync', syncRouter.routes());
|
||||
|
||||
app.use(router.routes());
|
||||
app.use(router.allowedMethods());
|
||||
|
|
13
backend/src/sync.ts
Normal file
13
backend/src/sync.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import * as Router from '@koa/router';
|
||||
|
||||
import taskwarrior from './taskwarrior';
|
||||
|
||||
const router = new Router();
|
||||
|
||||
router.post('/', async ctx => {
|
||||
const msg = taskwarrior.executeCommand('sync');
|
||||
console.log(msg);
|
||||
ctx.status = 200;
|
||||
});
|
||||
|
||||
export default router;
|
Loading…
Add table
Add a link
Reference in a new issue