Hey together, I have to connect to a postgres data...
# javascript
p
Hey together, I have to connect to a postgres database from Kotlin/JS. I don`t find any example. Is it possible to connect via exposed?
b
Exposed is only available on JVM. Your best bet is SQLDelight
a
You can't connect browser to DB. Some DBs support direct http requests, but in general, you need a backend server for that.
b
I assumed he's talking about nodeJS
p
Yes right.
I will try sqlDelight
r
I don't think you can use sqldelight from JS with Postgres
but you should be able to use any postgresql drivers for nodejs, e.g. https://node-postgres.com/
a
I am not sure why anyone would use kotlin-JS with node, so I could be biased.
r
nodejs has advantages in some areas, e.g. in the cloud
it's just another runtime environment, as good as all others, as long as you can write your code in Kotlin :-)
b
Except for the fact that Kotlin/JVM is much more mature than Kotlin/JS 😕
a
And always will be. Because you have intermediate lanaguage layer. It could be better with WASM.
r
typescript has js layer as well and holds up well :-)
a
Well... it is questionable. I do not write in TypeScript, but I heard different opinions on that.
b
I do write typescript and I have to say the experience is the same as Java in terms of maturity and stability
p
Is it possible to use sqldelight without the gradle plugin and only make some database connection and execute queries?
t
Hey, I also want to connect to a postgres database from Kotlin/JS, did you have any luck since 2020 ? ^^
148 Views