forked from Minecraft/Stonks
Prefix API routes with api/
parent
5945276b1d
commit
d65bb0445a
|
@ -24,7 +24,7 @@ fun initApiServer(apiServerPort: Int, database: Database) {
|
||||||
val app = Javalin.create().start(apiServerPort)
|
val app = Javalin.create().start(apiServerPort)
|
||||||
println("Javalin web server started")
|
println("Javalin web server started")
|
||||||
|
|
||||||
app.get("/statistics") { ctx ->
|
app.get("api/statistics") { ctx ->
|
||||||
run {
|
run {
|
||||||
if (statisticsCache.isEmpty() or
|
if (statisticsCache.isEmpty() or
|
||||||
(Duration.between(Instant.now(), statisticsCacheTimestamp) >
|
(Duration.between(Instant.now(), statisticsCacheTimestamp) >
|
||||||
|
@ -48,7 +48,7 @@ fun initApiServer(apiServerPort: Int, database: Database) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get("/statistics/:type/:name") { ctx ->
|
app.get("api/statistics/:type/:name") { ctx ->
|
||||||
run {
|
run {
|
||||||
transaction(database) {
|
transaction(database) {
|
||||||
addLogger(StdOutSqlLogger)
|
addLogger(StdOutSqlLogger)
|
||||||
|
@ -78,7 +78,7 @@ fun initApiServer(apiServerPort: Int, database: Database) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get("/players") { ctx ->
|
app.get("api/players") { ctx ->
|
||||||
run {
|
run {
|
||||||
if (playersCache.isEmpty() or
|
if (playersCache.isEmpty() or
|
||||||
(Duration.between(Instant.now(), playersCacheTimestamp) >
|
(Duration.between(Instant.now(), playersCacheTimestamp) >
|
||||||
|
@ -100,7 +100,7 @@ fun initApiServer(apiServerPort: Int, database: Database) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get("/players/:playerId") { ctx ->
|
app.get("api/players/:playerId") { ctx ->
|
||||||
run {
|
run {
|
||||||
transaction(database) {
|
transaction(database) {
|
||||||
addLogger(StdOutSqlLogger)
|
addLogger(StdOutSqlLogger)
|
||||||
|
@ -127,7 +127,7 @@ fun initApiServer(apiServerPort: Int, database: Database) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get("/players/:playerId/:type/:name") { ctx ->
|
app.get("api/players/:playerId/:type/:name") { ctx ->
|
||||||
run {
|
run {
|
||||||
transaction(database) {
|
transaction(database) {
|
||||||
addLogger(StdOutSqlLogger)
|
addLogger(StdOutSqlLogger)
|
||||||
|
|
Loading…
Reference in New Issue