Skip to content

Commit

Permalink
Change API versioning to match Cup version
Browse files Browse the repository at this point in the history
  • Loading branch information
sergi0g committed Dec 7, 2024
1 parent e5e60c4 commit f6ac43a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ pub async fn serve(port: &u16, config: &Config) -> std::io::Result<()> {
App::new()
.with_state(Arc::new(Mutex::new(data)))
.at("/", get(handler_service(_static)))
.at("/api/v1/simple", get(handler_service(api_simple)))
.at("/api/v1/full", get(handler_service(api_full)))
.at("/api/v1/json", get(handler_service(api_simple)))
.at("/api/v3/json", get(handler_service(api_full)))
.at("/api/v1/refresh", get(handler_service(refresh)))
.at("/api/v3/refresh", get(handler_service(refresh)))
.at("/*", get(handler_service(_static)))
.enclosed(Logger::new())
.serve()
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { theme } from "../theme";
export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
fetch(
process.env.NODE_ENV === "production"
? "/api/v1/full"
: `http://${window.location.hostname}:8000/api/v1/full`,
? "/api/v3/json"
: `http://${window.location.hostname}:8000/api/v3/json`,
).then((response) =>
response.json().then((data) => {
onLoad(data as Data);
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/RefreshButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export default function RefreshButton() {
request.open(
"GET",
process.env.NODE_ENV === "production"
? "/api/v1/refresh"
: `http://${window.location.hostname}:8000/api/v1/refresh`,
? "/api/v3/refresh"
: `http://${window.location.hostname}:8000/api/v3/refresh`,
);
request.send();
};
Expand Down

0 comments on commit f6ac43a

Please sign in to comment.