-
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.
Lets make the task better for the candidates - Added CORS, to save the candidate some time - Added another endpoint to have an even better starting point where there are examples for query parameters and some more linq expressions in the code
- Loading branch information
Martin Klingenberg
committed
Oct 18, 2024
1 parent
202ccda
commit 7a0e3c6
Showing
8 changed files
with
124 additions
and
37 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Palvkerings-oppgaven | ||
|
||
## Hvordan komme i gang | ||
Om man kjører applikasjonen fra host-mappa, så skal løsningen kunne åpnes på http://localhost:5000 | ||
``` shell | ||
cd src/Alv.Parkering.Host | ||
dotnet run | ||
``` | ||
|
||
|
||
## Endepunkter | ||
|
||
### http://localhost:5000/parkingspot?page=0&pageSize=25 | ||
``` json | ||
[ | ||
{ | ||
"address": "\u00d8vre Langgate 28", | ||
"freeParkingCount": 10, | ||
"paidParkingCount": 0, | ||
"charingSpotCount": 0, | ||
"handicapSpotCount": 0, | ||
"handicapDescription": "Det er vurdert at dette er en for liten og trang plass til å kunne tilrettelegge HC plass ihht kravene om utforming og st\u00f8rrelse. Det er kommunale HC plasser i nærheten (Conradisgt og Klostergaten)." | ||
} | ||
] | ||
``` | ||
|
||
|
||
### http://localhost:5000/parkingspot/all | ||
``` json | ||
[ | ||
{ | ||
"address": "\u00d8vre Langgate 28", | ||
"freeParkingCount": 10, | ||
"paidParkingCount": 0, | ||
"charingSpotCount": 0, | ||
"handicapSpotCount": 0, | ||
"handicapDescription": "Det er vurdert at dette er en for liten og trang plass til å kunne tilrettelegge HC plass ihht kravene om utforming og st\u00f8rrelse. Det er kommunale HC plasser i nærheten (Conradisgt og Klostergaten)." | ||
} | ||
] | ||
``` |
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
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
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 |
---|---|---|
@@ -1,14 +1,27 @@ | ||
using Alv.Parkering.Infrastructure; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
var AllowedOrigins = "_allowedOrigins"; | ||
|
||
// Add services to the container. | ||
|
||
builder.Services.AddControllers(); | ||
builder.Services.AddInfrastructure(); | ||
|
||
builder.Services.AddCors(options => | ||
{ | ||
options.AddPolicy( | ||
name: AllowedOrigins, | ||
policy => | ||
{ | ||
policy.WithOrigins("*", "*"); | ||
} | ||
); | ||
}); | ||
|
||
var app = builder.Build(); | ||
|
||
app.UseCors(AllowedOrigins); | ||
app.MapControllers(); | ||
|
||
app.Run(); |
Binary file not shown.
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