Handle location data on backend from id
This commit is contained in:
parent
728092dfed
commit
9fdff1ecba
@ -4,7 +4,7 @@
|
|||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
<file type="web" url="file://$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="temurin-18" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="temurin-18" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
20
locations.json
Normal file
20
locations.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "caiu",
|
||||||
|
"name": "Capital Area Intermediate Unit",
|
||||||
|
"address": "55 Miller St, Enola, PA, 17025",
|
||||||
|
"phone": "(717)732-8400"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "caelc",
|
||||||
|
"name": "Capital Area Early Learning Center",
|
||||||
|
"address": "4100 Gettysburg Rd, Camp Hill, PA, 17011",
|
||||||
|
"phone": "(717)732-"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "hta",
|
||||||
|
"name": "Hill Top Academy",
|
||||||
|
"address": "405 E Winding Hill Rd, Mechanicsburg, PA, 17055",
|
||||||
|
"phone": "(717)732-8484"
|
||||||
|
}
|
||||||
|
]
|
@ -7,6 +7,7 @@ import javax.imageio.ImageIO;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static spark.Spark.*;
|
import static spark.Spark.*;
|
||||||
@ -38,11 +39,12 @@ public class Main {
|
|||||||
res.status(200);
|
res.status(200);
|
||||||
res.type("application/json");
|
res.type("application/json");
|
||||||
res.header("Access-Control-Allow-Origin", "*");
|
res.header("Access-Control-Allow-Origin", "*");
|
||||||
return Main.class.getResourceAsStream("/locations.json");
|
return new FileInputStream("locations.json");
|
||||||
});
|
});
|
||||||
|
|
||||||
post("/", (req, res) -> {
|
post("/", (req, res) -> {
|
||||||
res.type("image/png");
|
res.type("image/png");
|
||||||
|
res.header("Access-Control-Allow-Origin", "*");
|
||||||
JsonObject data = new Gson().fromJson(req.body(), JsonObject.class);
|
JsonObject data = new Gson().fromJson(req.body(), JsonObject.class);
|
||||||
return generate(
|
return generate(
|
||||||
data.get("name").getAsString(),
|
data.get("name").getAsString(),
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"locations": [
|
|
||||||
{
|
|
||||||
"caiu": {
|
|
||||||
"name": "Capital Area Intermediate Unit",
|
|
||||||
"address": "55 Miller St, Enola, PA, 17025",
|
|
||||||
"phone": "(717)732-8400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"caelc": {
|
|
||||||
"name": "Capital Area Early Learning Center",
|
|
||||||
"address": "4100 Gettysburg Rd, Camp Hill, PA, 17011",
|
|
||||||
"phone": "(717)732-"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hta": {
|
|
||||||
"name": "Hill Top Academy",
|
|
||||||
"address": "405 E Winding Hill Rd, Mechanicsburg, PA, 17055",
|
|
||||||
"phone": "(717)732-8484"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user