Skip to content

Commit 1ebb1bf

Browse files
committed
feat: Change H2 mode to start web console on localhost:8082
1 parent 9534c2d commit 1ebb1bf

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,20 @@ You need just JVM installed.
6464

6565
The server is configured to start on [7000](http://localhost:7000/api) with `api` context, but you can change in `koin.properties`.
6666

67-
Build:
67+
#### Build:
6868
> ./gradlew clean build
6969
70-
Start the server:
70+
#### Start the server:
7171
> ./gradlew run
7272
7373
In the project have the [spec-api](https://github.com/Rudge/kotlin-javalin-realworld-example-app/tree/master/spec-api) with the README and collections to execute backend tests specs [realworld](https://github.com/gothinkster/realworld).
7474

75-
Execute tests and start the server:
75+
You can access the h2-console at [console](http://localhost:8082/).
76+
77+
#### Execute tests and start the server:
7678

7779
> ./gradlew run & APIURL=http://localhost:7000/api ./spec-api/run-api-tests.sh
7880
7981
# Help
8082

81-
Please fork and PR to improve the code.
83+
Please fork and PR to improve the code.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package io.realworld.app
22

33
import io.realworld.app.config.AppConfig
4+
import org.h2.tools.Server
45

56
fun main(args: Array<String>) {
7+
Server.createWebServer().start()
68
AppConfig().setup().start()
7-
}
9+
}

src/main/kotlin/io/realworld/app/config/AppConfig.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import io.javalin.json.JavalinJackson
88
import io.realworld.app.config.ModulesConfig.allModules
99
import io.realworld.app.web.ErrorExceptionMapping
1010
import io.realworld.app.web.Router
11-
import org.h2.tools.Server
1211
import org.koin.core.KoinProperties
1312
import org.koin.standalone.KoinComponent
1413
import org.koin.standalone.StandAloneContext
@@ -30,7 +29,6 @@ class AppConfig : KoinComponent {
3029
.contextPath(getProperty("context"))
3130
.event(JavalinEvent.SERVER_STOPPING) {
3231
StandAloneContext.stopKoin()
33-
Server.createPgServer().stop()
3432
}
3533
authConfig.configure(app)
3634
router.register(app)

src/main/kotlin/io/realworld/app/config/DbConfig.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ package io.realworld.app.config
22

33
import com.zaxxer.hikari.HikariConfig
44
import com.zaxxer.hikari.HikariDataSource
5-
import org.h2.tools.Server
65
import javax.sql.DataSource
76

87
class DbConfig(jdbcUrl: String, username: String, password: String) {
98
private val dataSource: DataSource
109

1110
init {
12-
Server.createPgServer().start()
1311
dataSource = HikariConfig().let { config ->
1412
config.jdbcUrl = jdbcUrl
1513
config.username = username
@@ -21,4 +19,4 @@ class DbConfig(jdbcUrl: String, username: String, password: String) {
2119
fun getDataSource(): DataSource {
2220
return dataSource
2321
}
24-
}
22+
}

0 commit comments

Comments
 (0)