Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
app-todo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Geovanny E. Vera Pazmino
app-todo
Commits
dfa03faf
Commit
dfa03faf
authored
Apr 07, 2020
by
Milan Iliev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Server: update task
parent
6a1a87a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
main.js
server/main.js
+15
-2
No files found.
server/main.js
View file @
dfa03faf
const
Koa
=
require
(
'koa'
)
const
Koa
=
require
(
'koa'
)
const
logger
=
require
(
'koa-logger'
)
const
logger
=
require
(
'koa-logger'
)
const
Router
=
require
(
'@koa/router'
)
const
Router
=
require
(
'@koa/router'
)
const
serve
=
require
(
'koa-static'
)
const
serve
=
require
(
'koa-static'
)
const
router
=
new
Router
()
const
router
=
new
Router
()
router
.
get
(
"/tasks"
,
async
(
context
)
=>
{
router
.
get
(
"/tasks"
,
async
(
context
)
=>
{
...
@@ -12,6 +12,19 @@ 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
()
const
app
=
new
Koa
()
app
.
use
(
serve
(
`
${
__dirname
}
/../web`
))
app
.
use
(
serve
(
`
${
__dirname
}
/../web`
))
app
.
use
(
logger
())
app
.
use
(
logger
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment