How can I make it so I host the website & the backend in the ktor app. I was thinking of static content and then XMLHTTPRequest to access the backend api:
ktor app
+-----------
/ -> public/index.html (has assets that also need to be accessible from the /public folder)
/security -> public/security.html (has assets that also need to be accessible from the /public folder)
/api -> handled by the api using GET, POST, etc. functions
How should my routes look?
EDIT: I tried this but it didn't really work. /api returned correctly but / and /index.html or any other asset in /public did not show up.
If you have a static website, then yes, you can just serve it as static or even use any kind of view engine. Not show up you mean how? 404?
d
Dominick
04/22/2021, 5:29 AM
@hhariri I want to serve the html with js and css in different files (all in /public) at the root of the website, then override /api and /file to be handled by get("/api") etc etc
h
hhariri
04/22/2021, 5:29 AM
That should work with a single entry for your route to resources. You don’t need to do further mappings in static.
d
Dominick
04/22/2021, 5:30 AM
Can you give me an example Route for that? I have tried many things and they don't work for me