File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
app/src/main/java/hexlet/code Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,6 @@ public class App {
2323
2424 public static void main (String [] args ) throws SQLException , IOException {
2525 var app = getApp ();
26- app .before (ctx -> LOG .info (Instant .now ().toString ()));
27-
28- app .get (NamedRoutes .rootPath (), ctx -> ctx .result ("Hello World" ));
29-
3026 app .start (getPort ());
3127 }
3228
@@ -52,12 +48,14 @@ private static Javalin getApp() throws SQLException, IOException {
5248 hikariConfig .setJdbcUrl (getDatabaseUrl ());
5349 var dataSource = new HikariDataSource (hikariConfig );
5450
55- var sql = readResourceFile ("schema.sql" );
5651 try (
5752 var connection = dataSource .getConnection ();
5853 var statement = connection .createStatement ()
5954 ) {
55+ var sql = readResourceFile ("schema.sql" );
6056 statement .execute (sql );
57+ } catch (NullPointerException e ) {
58+ System .out .println ("No SQL schema found" );
6159 }
6260
6361 BaseRepository .dataSource = dataSource ;
@@ -67,6 +65,10 @@ private static Javalin getApp() throws SQLException, IOException {
6765 config .fileRenderer (new JavalinJte ());
6866 });
6967
68+ app .before (ctx -> LOG .info (Instant .now ().toString ()));
69+
70+ app .get (NamedRoutes .rootPath (), ctx -> ctx .result ("Hello World" ));
71+
7072 return app ;
7173 }
7274}
You can’t perform that action at this time.
0 commit comments