package org.opendc.common.utils import io.javalin.Javalin import io.javalin.http.Handler /** * Represents the digital twin monitoring server. * @author Mateusz Kwiatkowski * @see https://javalin.io/documentation */ public class JavalinRunner { private val handshake: Handler = Handler { ctx -> ctx.status(200) } private val scenario: Handler = Handler { ctx -> } init { // Make a CRUD RESTful API // Specify server config val app = Javalin.create().start() // returns a list of all experiments app.get("/experiment", handshake) // returns a specific experiment app.get("/experiment/:id", handshake) // you need another endpoint for the metrics // get the results for the metrics evaluation app.get("/results/:id", handshake) // returns all results app.get("/results", handshake) // sends a specific experiment app.post("/experiment", scenario) // changes a specific experiment app.put("/experiment/:id", scenario) // this should delete metrics associated with the experiment // deletes an experiment with id app.delete("/experiment/:id", scenario) // deletes all experiments app.delete("/experiment", scenario) } }