@@ -13,7 +13,10 @@ import io.ktor.server.application.call
13
13
import io.ktor.server.engine.embeddedServer
14
14
import io.ktor.server.netty.Netty
15
15
import io.ktor.server.response.respondText
16
+ import io.ktor.server.routing.delete
16
17
import io.ktor.server.routing.get
18
+ import io.ktor.server.routing.patch
19
+ import io.ktor.server.routing.post
17
20
import io.ktor.server.routing.routing
18
21
19
22
/* *
@@ -45,8 +48,14 @@ class APIController {
45
48
private fun roomAPI (app : Application ) {
46
49
with (app) {
47
50
routing {
48
- get(" /room" ) {
49
- call.respondText(" [${Thread .currentThread().name} ] Room!" )
51
+ post(" $apiPath /rooms" ) {
52
+ call.respondText(" [${Thread .currentThread().name} ] Room POST!" )
53
+ }
54
+ get(" $apiPath /rooms/{room-id}" ) {
55
+ call.respondText(" [${Thread .currentThread().name} ] Room GET!" )
56
+ }
57
+ delete(" $apiPath /rooms/{room-id}" ) {
58
+ call.respondText(" [${Thread .currentThread().name} ] Room DELETE!" )
50
59
}
51
60
}
52
61
}
@@ -59,10 +68,23 @@ class APIController {
59
68
private fun medicalTechnologyPI (app : Application ) {
60
69
with (app) {
61
70
routing {
62
- get(" /medicaltechnology" ) {
63
- call.respondText(" [${Thread .currentThread().name} ] Medical Technology!" )
71
+ post(" $apiPath /medicalTechnologies" ) {
72
+ call.respondText(" [${Thread .currentThread().name} ] Medical Technology POST!" )
73
+ }
74
+ get(" $apiPath /medicalTechnologies/{technology-id}" ) {
75
+ call.respondText(" [${Thread .currentThread().name} ] Medical Technology GET!" )
76
+ }
77
+ delete(" $apiPath /medicalTechnologies/{technology-id}" ) {
78
+ call.respondText(" [${Thread .currentThread().name} ] Medical Technology DELETE!" )
79
+ }
80
+ patch(" $apiPath /medicalTechnologies/{technology-id}" ) {
81
+ call.respondText(" [${Thread .currentThread().name} ] Medical Technology PATCH!" )
64
82
}
65
83
}
66
84
}
67
85
}
86
+
87
+ companion object {
88
+ private const val apiPath = " /api"
89
+ }
68
90
}
0 commit comments