From aa167d58a0a36ae5bc61731f2e8de11fd9633c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amalie=20Mans=C3=A5ker?= Date: Thu, 20 Jul 2023 13:27:42 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20N=C3=A5=20mulig=20=C3=A5=20kj=C3=B8?= =?UTF-8?q?re=20applikasjonen=20lokalt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sindre Kjelsrud Co-authored-by: Markus A. R. Johansen Co-authored-by: Christian Bülow Skovborg --- .../kotlin/no/nav/helse/sprik/plugins/Routing.kt | 5 ++++- backend/src/test/kotlin/LocalApp.kt.kt | 13 +++++++++++++ frontend/vite.config.ts | 9 +++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 backend/src/test/kotlin/LocalApp.kt.kt diff --git a/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt b/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt index de18b2f..3f258fe 100644 --- a/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt +++ b/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt @@ -44,11 +44,14 @@ fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngin get("/isready"){ call.respondText("READY") } + get("/api/test") { + call.respondText("test") + } post("/test") { val test = call.receive() call.respond(status = HttpStatusCode.Created, message = test) } - post("/nyfeil") { + post("/api/nyfeil") { val feilmelding = call.receive() feilmeldingRepository.lagre(feilmelding) call.respond(status = HttpStatusCode.Created, message = "Feilmelding motatt og sendt til database") diff --git a/backend/src/test/kotlin/LocalApp.kt.kt b/backend/src/test/kotlin/LocalApp.kt.kt new file mode 100644 index 0000000..88b5ced --- /dev/null +++ b/backend/src/test/kotlin/LocalApp.kt.kt @@ -0,0 +1,13 @@ +import no.nav.helse.sprik.Application +import no.nav.helse.sprik.configureFlyway +import no.nav.helse.sprik.db.Database +import no.nav.helse.sprik.dbconfig + + +fun main() { + + val db = Database(dbconfig()).configureFlyway() + val app = Application(db) + + app.startBlocking() +} diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 5a33944..210cde2 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -4,4 +4,13 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + server: { + headers: {}, + proxy: { + '/api': { + target: 'http://localhost:8080', + changeOrigin: true, + }, + }, + }, })