Commit dfa03faf authored by Milan Iliev's avatar Milan Iliev

Server: update task

parent 6a1a87a4
const Koa = require('koa')
const Koa = require('koa')
const logger = require('koa-logger')
const Router = require('@koa/router')
const serve = require('koa-static')
const serve = require('koa-static')
const router = new Router()
router.get("/tasks", async (context) => {
......@@ -12,6 +12,19 @@ router.get("/tasks", async (context) => {
]
})
router.put("/tasks/:id", async (context) => {
let task_id = context.request.params["id"]
let updated_task_data = context.request.body
let task = tasks.find((task) => task.id === task_id )
task.done = updated_task_data.done
task.description = updated_task_data.description
context.response.status = 204
})
const app = new Koa()
app.use(serve(`${__dirname}/../web`))
app.use(logger())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment