Ролан
05/07/2021, 5:26 PMGeert
05/14/2021, 12:09 PMAbdulazeez Olaitan Gbindinninuola
05/18/2021, 10:39 AMByron Katz
05/20/2021, 10:12 PMasavio
05/21/2021, 12:37 PMVasily Scherbakov
05/23/2021, 12:28 PMAccess to fetch at '<http://127.0.0.1:8080/api/run?userId=root&profile=test>' from origin '<http://localhost:3000>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled
As i understand, i should add origin to list of allowed origins in my backend app, i do this that way
install(CORS){
method(HttpMethod.Get)
method(<http://HttpMethod.Post|HttpMethod.Post>, )
method(HttpMethod.Delete)
anyHost()
host("localhost")
}
But this dont work.
This is headers of response from js clinet
'Origin': '<http://localhost:3000>',
'Content-Type': 'application/json',
'Accept': 'application/json',
'Access-Control-Request-Headers': 'Content-Type, Authorization'
Can anyone help me please?Darren Lambert
05/24/2021, 10:04 PM2021-05-24 17:50:38.841 [eventLoopGroupProxy-4-1] ERROR ktor.application - Unhandled: POST - /Music/Add
io.ktor.features.CannotTransformContentToTypeException: Cannot transform this request's content to Musics
What i have do wrong in my code ? 🥲 (I have do many research and soluce but he doesn't work)
post("/Add") {
val post = call.receive<Musics>()
aMusicDAO.addMusic(post)
call.respondText("OK OK",ContentType.Text.Plain)
}
@Serializable
data class Musics(
val tag:Int? =null,
@JsonInclude(value=JsonInclude.Include.NON_NULL)
val title:String?="",
val artist:String?="",
val duration: String?="",
val tagU:Int? =null
)
override fun addMusic(music: Musics){
transaction {
Music.insert{
it[title]= music.title ?:""
it[artist]=music.artist?:""
it[duration]=music.duration?:""
it[tagU]=music.tagU?:0
}
}
}
ESchouten
05/26/2021, 9:58 PMSlackbot
05/30/2021, 11:32 AMninad thakare
05/30/2021, 1:25 PMDebanshu Datta
05/30/2021, 5:12 PMJoão Rodrigues
06/01/2021, 9:55 AMcuongtd
06/05/2021, 5:20 AMjmfayard
06/07/2021, 5:04 PMSlackbot
06/10/2021, 2:29 AMSergey
06/10/2021, 7:17 PMMichael Grigoryan
06/11/2021, 6:31 PMHafs
06/12/2021, 9:15 PMVoytech
06/13/2021, 12:14 PMPavel Petkevich
06/14/2021, 5:01 PMLena Stepanova
06/16/2021, 9:45 AMHusam
06/18/2021, 12:22 PMchristophsturm
06/21/2021, 9:33 AMreperion.kim
06/22/2021, 1:02 AMCisino da Silva Gomes Junior
06/25/2021, 6:19 PMiamraghavawasthi
06/28/2021, 7:17 PMLuiz Aguiar
06/30/2021, 10:15 PMjmfayard
07/02/2021, 8:57 AMРолан
07/06/2021, 11:44 AMAmitav Khandelwal
07/08/2021, 9:19 AMdata class
es, like Step1Output
, which becomes the input for step 2, and so on. I’ve managed to make the step functions are pure functions this way, which I believe is a best practice.
My problem now is that in case I need to introduce anything new in the output that requires another piece of data from the input, I need to modify all my StepXOutput
classes and keep passing on the data between them. This obviously makes doing any changes slow and painful.
Any ideas on design patterns that can help with this? Or is there some well-architected, complex project that I can look at for reference? Thanks!