Created
November 30, 2019 09:53
-
-
Save toantran-ea/fa3e8be53e8c58f8083aa72174382b04 to your computer and use it in GitHub Desktop.
Connect attempt 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.demo | |
| // import | |
| val dataRepo = DataRepository() | |
| fun Application.main() { | |
| // ... | |
| post("entries") { | |
| val entries = fromJsonStringToList(call.receiveText()) | |
| val savedKeys = dataRepo.save(entries) | |
| call.respondText(contentType = ContentType.Application.Json) { | |
| Json.stringify(String.serializer().list, savedKeys.map { it.id.toString() }) | |
| } | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment