Nå mulig å kjøre applikasjonen lokalt

Co-authored-by: Sindre Kjelsrud <sindre.kjelsrud@nav.no>
Co-authored-by: Markus A. R. Johansen <markus.aleksander.rakil.johansen@nav.no>
Co-authored-by: Christian Bülow Skovborg <christian.bulow.skovborg@nav.no>
This commit is contained in:
Amalie Mansåker 2023-07-20 13:27:42 +02:00
parent 9248607efa
commit aa167d58a0
3 changed files with 26 additions and 1 deletions

View file

@ -44,11 +44,14 @@ fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngin
get("/isready"){ get("/isready"){
call.respondText("READY") call.respondText("READY")
} }
get("/api/test") {
call.respondText("test")
}
post("/test") { post("/test") {
val test = call.receive<Test>() val test = call.receive<Test>()
call.respond(status = HttpStatusCode.Created, message = test) call.respond(status = HttpStatusCode.Created, message = test)
} }
post("/nyfeil") { post("/api/nyfeil") {
val feilmelding = call.receive<Feilmelding>() val feilmelding = call.receive<Feilmelding>()
feilmeldingRepository.lagre(feilmelding) feilmeldingRepository.lagre(feilmelding)
call.respond(status = HttpStatusCode.Created, message = "Feilmelding motatt og sendt til database") call.respond(status = HttpStatusCode.Created, message = "Feilmelding motatt og sendt til database")

View file

@ -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()
}

View file

@ -4,4 +4,13 @@ import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
server: {
headers: {},
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
},
},
},
}) })