Skip to content
Snippets Groups Projects
Commit a8b87283 authored by joeappleton18's avatar joeappleton18
Browse files

finished 2.4 solution

parent 12d9957f
No related branches found
No related tags found
No related merge requests found
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
......@@ -12,4 +12,4 @@ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8
package com.yatl;
import io.javalin.Javalin;
public class AppConfig {
public static Javalin startServer(int port) {
Javalin app = Javalin.create().start(port);
app.get("/todos", ctx -> ctx.result("get all todos"));
app.get("/todos/{id}", ctx -> ctx.result("get all todos"));
return app;
}
}
package com.yatl;
import java.net.URL;
import java.sql.SQLException;
import java.util.List;
import com.yatl.util.Database;
import com.yatl.dao.TodoDao;
import com.yatl.model.Todo;
public class Main {
public static void main(String[] args) {
URL resourceFolderUrl = Main.class.getClassLoader().getResource("");
String databasePath = resourceFolderUrl.getPath() + "database.db";
String url = "jdbc:sqlite:" + databasePath;
Database.getInstance(url);
try {
TodoDao tododao = new TodoDao();
List<Todo> todos = tododao.getAll();
for (Todo todo : todos) {
System.out.println(todo.toString());
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
AppConfig.startServer(8000);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment