This repository has been archived by the owner on Apr 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ spring: | |
springdoc: | ||
api-docs.path: /docs | ||
swagger-ui.path: /docs/swagger | ||
|
||
googlemaps.apikey: <google-maps-api-key> |
30 changes: 30 additions & 0 deletions
30
src/main/java/studentscroll/api/maps/MapsRestController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package studentscroll.api.maps; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import studentscroll.api.maps.dto.APIKeyResponse; | ||
|
||
@Tag(name = "Maps") | ||
@SecurityRequirement(name = "token") | ||
@RestController | ||
@RequestMapping("/maps") | ||
public class MapsRestController { | ||
|
||
@Value("${googlemaps.apikey}") | ||
private String apiKey; | ||
|
||
@Operation(summary = "Retrieve the Google Maps API key.") | ||
@ApiResponse(responseCode = "200", description = "Returning the API key.") | ||
@GetMapping | ||
public APIKeyResponse read() { | ||
return new APIKeyResponse(apiKey); | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/studentscroll/api/maps/dto/APIKeyResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package studentscroll.api.maps.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class APIKeyResponse { | ||
|
||
private final String apiKey; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters