Skip to content

Commit 4f5f778

Browse files
author
Bradley
committed
updated backend to serve static files from a location given by the environment
1 parent 82f0681 commit 4f5f778

File tree

18 files changed

+34
-0
lines changed

18 files changed

+34
-0
lines changed

backend/src/main/java/merhoo/backend/App.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ public static void main(String[] args) {
3030
// with IDs starting over from 0.
3131
final DataStore dataStore = new DataStore();
3232

33+
// Set up the location for serving static files
34+
Spark.staticFileLocation("/web");
35+
36+
// Set up a route for serving the main page
37+
Spark.get("/", (req, res) -> {
38+
res.redirect("/index.html");
39+
return "";
40+
});
41+
3342
// GET route that returns all message titles and Ids. All we do is get
3443
// the data, embed it in a StructuredResponse, turn it into JSON, and
3544
// return it. If there's no data, we return "[]", so there's no need
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)