Skip to content

Commit c43ca26

Browse files
committed
Replace the legacy example site with a minimal API sample
Retire the old MVC example project in favor of an SDK-style ASP.NET Core sample that matches the modernized solution layout and tooling. The new sample keeps provider discovery explicit, validates reverse-geocode input up front, and returns handled problem responses when a provider is unavailable or rejects a request so the out-of-box experience is diagnosable instead of failing with unhandled exceptions.
1 parent 9b56ff0 commit c43ca26

File tree

23 files changed

+429
-824
lines changed

23 files changed

+429
-824
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/bin
22
/packages
3-
/examples/packages
3+
/samples/packages
44
test/Geocoding.Tests/settings-override.json
55

66
.vs

.vscode/launch.json

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,31 @@
22
"version": "0.2.0",
33
"configurations": [
44
{
5-
"name": ".NET Core Launch (console)",
5+
"name": "Launch Example.Web",
66
"type": "coreclr",
77
"request": "launch",
8-
"preLaunchTask": "build",
9-
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
10-
"args": [],
11-
"cwd": "${workspaceRoot}",
12-
"externalConsole": false,
13-
"stopAtEntry": false
8+
"preLaunchTask": "build example",
9+
"program": "dotnet",
10+
"args": [
11+
"run",
12+
"--project",
13+
"${workspaceFolder}/samples/Example.Web/Example.Web.csproj"
14+
],
15+
"cwd": "${workspaceFolder}",
16+
"env": {
17+
"ASPNETCORE_ENVIRONMENT": "Development"
18+
},
19+
"stopAtEntry": false,
20+
"serverReadyAction": {
21+
"action": "openExternally",
22+
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
23+
}
1424
},
1525
{
1626
"name": ".NET Core Attach",
1727
"type": "coreclr",
1828
"request": "attach",
19-
"processId": "${command.pickProcess}"
29+
"processId": "${command:pickProcess}"
2030
}
2131
]
2232
}

.vscode/tasks.json

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,65 @@
11
{
22
"version": "2.0.0",
3-
"command": "dotnet",
4-
"args": [],
53
"tasks": [
64
{
75
"label": "build",
86
"type": "shell",
97
"command": "dotnet",
108
"args": [
119
"build",
12-
""
10+
"Geocoding.slnx"
1311
],
1412
"problemMatcher": "$msCompile",
1513
"group": {
16-
"_id": "build",
17-
"isDefault": false
14+
"kind": "build",
15+
"isDefault": true
1816
}
17+
},
18+
{
19+
"label": "test",
20+
"type": "shell",
21+
"command": "dotnet",
22+
"args": [
23+
"test",
24+
"--project",
25+
"test/Geocoding.Tests/Geocoding.Tests.csproj"
26+
],
27+
"problemMatcher": "$msCompile",
28+
"group": "test"
29+
},
30+
{
31+
"label": "pack",
32+
"type": "shell",
33+
"command": "dotnet",
34+
"args": [
35+
"pack",
36+
"Geocoding.slnx",
37+
"--configuration",
38+
"Release"
39+
],
40+
"problemMatcher": "$msCompile"
41+
},
42+
{
43+
"label": "build example",
44+
"type": "shell",
45+
"command": "dotnet",
46+
"args": [
47+
"build",
48+
"samples/Example.Web/Example.Web.csproj"
49+
],
50+
"problemMatcher": "$msCompile"
51+
},
52+
{
53+
"label": "run example",
54+
"type": "shell",
55+
"command": "dotnet",
56+
"args": [
57+
"run",
58+
"--project",
59+
"samples/Example.Web/Example.Web.csproj"
60+
],
61+
"isBackground": true,
62+
"problemMatcher": []
1963
}
2064
]
2165
}

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ src/
4242
└── Geocoding.Yahoo # Yahoo geocoding provider
4343
test/
4444
└── Geocoding.Tests # xUnit tests for all providers
45-
examples/
45+
samples/
4646
└── Example.Web # Sample web application
4747
```
4848

Geocoding.slnx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@
1010
<Folder Name="/test/">
1111
<Project Path="test/Geocoding.Tests/Geocoding.Tests.csproj" />
1212
</Folder>
13+
<Folder Name="/samples/">
14+
<Project Path="samples/Example.Web/Example.Web.csproj" />
15+
</Folder>
1316
</Solution>

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Generic C# Geocoding API [![Build Status](http://teamcity.chadly.net/app/rest/builds/buildType:(id:GeocodingNe_Build)/statusIcon)](http://teamcity.chadly.net/viewType.html?buildTypeId=GeocodingNe_Build&guest=1)
1+
# Generic C# Geocoding API [![CI](https://github.com/exceptionless/Geocoding.net/actions/workflows/build.yml/badge.svg)](https://github.com/exceptionless/Geocoding.net/actions/workflows/build.yml) [![Publish Packages](https://github.com/exceptionless/Geocoding.net/actions/workflows/publish-packages.yml/badge.svg)](https://github.com/exceptionless/Geocoding.net/actions/workflows/publish-packages.yml) [![CodeQL](https://github.com/exceptionless/Geocoding.net/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/exceptionless/Geocoding.net/actions/workflows/codeql-analysis.yml)
22

33
Includes a model and interface for communicating with five popular Geocoding providers. Current implementations include:
44

5-
* [Google Maps](https://developers.google.com/maps/) - [docs](https://developers.google.com/maps/documentation/geocoding/)
6-
* [Yahoo! BOSS Geo Services](http://developer.yahoo.com/boss/geo/) - [docs](http://developer.yahoo.com/geo/placefinder/guide/index.html)
7-
* [Bing Maps (aka Virtual Earth)](http://www.microsoft.com/maps/) - [docs](http://msdn.microsoft.com/en-us/library/ff701715.aspx)
8-
* :warning: MapQuest [(Commercial API)](http://www.mapquestapi.com/) - [docs](http://www.mapquestapi.com/geocoding/)
9-
* :warning: MapQuest [(OpenStreetMap)](http://open.mapquestapi.com/) - [docs](http://open.mapquestapi.com/geocoding/)
10-
* [HERE](https://www.here.com/) - [docs](https://developer.here.com/documentation)
5+
* [Google Maps](https://developers.google.com/maps/) - [Google geocoding docs](https://developers.google.com/maps/documentation/geocoding/)
6+
* [Yahoo! BOSS Geo Services](http://developer.yahoo.com/boss/geo/) - [Yahoo PlaceFinder docs](http://developer.yahoo.com/geo/placefinder/guide/index.html)
7+
* [Bing Maps (aka Virtual Earth)](http://www.microsoft.com/maps/) - [Bing geocoding docs](http://msdn.microsoft.com/en-us/library/ff701715.aspx)
8+
* :warning: MapQuest [(Commercial API)](http://www.mapquestapi.com/) - [MapQuest geocoding docs](http://www.mapquestapi.com/geocoding/)
9+
* :warning: MapQuest [(OpenStreetMap)](http://open.mapquestapi.com/) - [MapQuest OpenStreetMap geocoding docs](http://open.mapquestapi.com/geocoding/)
10+
* [HERE Maps](https://www.here.com/) - [HERE developer documentation](https://developer.here.com/documentation)
1111

1212
The API returns latitude/longitude coordinates and normalized address information. This can be used to perform address validation, real time mapping of user-entered addresses, distance calculations, and much more.
1313

14-
See latest [release notes](https://github.com/chadly/Geocoding.net/releases/latest).
14+
See latest [release notes](https://github.com/exceptionless/Geocoding.net/releases/latest).
1515

1616
:warning: There is a potential issue ([#29](https://github.com/chadly/Geocoding.net/issues/29)) regarding MapQuest that has a workaround. If you would like to help fix the issue, PRs are welcome.
1717

@@ -89,3 +89,15 @@ Alternatively, if you are on Windows, you can open the solution in [Visual Studi
8989
### Service Tests
9090

9191
You will need to generate API keys for each respective service to run the service tests. Make a `settings-override.json` as a copy of `settings.json` in the test project and put in your API keys. Then you should be able to run the tests.
92+
93+
Most provider-backed integration tests skip with a message indicating which setting is required when credentials are missing. The Yahoo suite is still explicitly skipped while issue #27 remains open, but it now uses the same credential checks when those tests are re-enabled.
94+
95+
## Sample App
96+
97+
The sample app in `samples/Example.Web` is an ASP.NET Core 10 minimal API that can geocode and reverse geocode against any configured provider.
98+
99+
```bash
100+
dotnet run --project samples/Example.Web/Example.Web.csproj
101+
```
102+
103+
Configure a provider in `samples/Example.Web/appsettings.json` or via environment variables such as `Providers__Google__ApiKey`. Once the app is running, use `samples/Example.Web/sample.http` to call `/providers`, `/geocode`, and `/reverse`.

0 commit comments

Comments
 (0)