backend update + README. Fixes https://github.com/joreilly/PeopleInSpace/issues/43
This commit is contained in:
parent
200d86976a
commit
f2a1b35295
2 changed files with 2 additions and 14 deletions
|
@ -34,6 +34,8 @@ beyond this then I'd definitely recommend checking out [KaMPKit](https://github.
|
|||
### Building
|
||||
You need to use Android Studio Canary version (**note: Java 11 is now the minimum version required**). Have tested with XCode v11 and v12. When opening
|
||||
iOS/watchOS/macOS projects remember to open `.xcworkspace` file (and not `.xcodeproj` one). To exercise web client run `./gradlew :web:browserDevelopmentRun`.
|
||||
To run backend you can either run `./gradlew :backend:run` or run `Server.kt` directly from Android Studio.
|
||||
After doing that you should then for example be able to open `http://localhost:9090/astros_local.json` in a browser.
|
||||
|
||||
**UPDATE**: now also works in stable version of Android Studio.
|
||||
|
||||
|
|
|
@ -10,9 +10,6 @@ import com.surrus.common.remote.Assignment
|
|||
import io.ktor.application.call
|
||||
import io.ktor.application.install
|
||||
import io.ktor.features.ContentNegotiation
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.content.resources
|
||||
import io.ktor.http.content.static
|
||||
|
||||
|
||||
fun main() {
|
||||
|
@ -26,17 +23,6 @@ fun main() {
|
|||
|
||||
routing {
|
||||
|
||||
get("/") {
|
||||
call.respondText(
|
||||
this::class.java.classLoader.getResource("index.html")!!.readText(),
|
||||
ContentType.Text.Html
|
||||
)
|
||||
}
|
||||
|
||||
static("/") {
|
||||
resources("")
|
||||
}
|
||||
|
||||
get("/astros.json") {
|
||||
val result = peopleInSpaceApi.fetchPeople()
|
||||
call.respond(result)
|
||||
|
|
Loading…
Reference in a new issue