Skip to content

Commit 0fa2dd2

Browse files
committed
update
1 parent 81ce277 commit 0fa2dd2

File tree

6 files changed

+45
-10
lines changed

6 files changed

+45
-10
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ docker run -it mcr.microsoft.com/dotnet/sdk:6.0-alpine sh
168168
```bash
169169
docker build -t url-shortener-net6 .
170170
docker run -it --rm -p 8080:80 url-shortener-net6
171+
# then visit http://localhost:8080/
171172
```
172173

173174
## License

src/Program.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
using System;
2-
using Microsoft.AspNetCore.Builder;
3-
using Microsoft.Extensions.DependencyInjection;
4-
using Microsoft.Extensions.Hosting;
5-
using Microsoft.AspNetCore.Http;
61
using LiteDB;
7-
using System.Threading.Tasks;
8-
using System.Linq;
92
using Microsoft.AspNetCore.WebUtilities;
103

114
var builder = WebApplication.CreateBuilder(args);
@@ -34,7 +27,7 @@
3427

3528
static async Task ShortenerDelegate(HttpContext httpContext)
3629
{
37-
var request = await httpContext.Request.ReadFromJsonAsync<UrlDto>();
30+
var request = await httpContext.Request.ReadFromJsonAsync<UrlDto>() ?? new UrlDto();
3831

3932
if (!Uri.TryCreate(request.Url, UriKind.Absolute, out var inputUri))
4033
{
@@ -80,5 +73,5 @@ public ShortUrl(Uri url)
8073

8174
public class UrlDto
8275
{
83-
public string Url { get; set; }
76+
public string Url { get; set; } = string.Empty;
8477
}

src/Properties/launchSettings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"profiles": {
3+
"UrlShortener": {
4+
"commandName": "Project",
5+
"launchBrowser": true,
6+
"environmentVariables": {
7+
"ASPNETCORE_ENVIRONMENT": "Development"
8+
},
9+
"applicationUrl": "https://localhost:60624;http://localhost:60625"
10+
}
11+
}
12+
}

src/UrlShortener.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
55
<LangVersion>preview</LangVersion>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
68
</PropertyGroup>
79

810
<ItemGroup>
9-
<PackageReference Include="LiteDB" Version="5.0.10" />
11+
<PackageReference Include="LiteDB" Version="5.0.12" />
1012
</ItemGroup>
1113

1214
<ItemGroup>

src/UrlShortener.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32901.215
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UrlShortener", "UrlShortener.csproj", "{7401B08A-ADF7-4062-8243-CC655278D024}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{7401B08A-ADF7-4062-8243-CC655278D024}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{7401B08A-ADF7-4062-8243-CC655278D024}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{7401B08A-ADF7-4062-8243-CC655278D024}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{7401B08A-ADF7-4062-8243-CC655278D024}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {B9621AD7-85F3-4AE7-9B28-06B86090EDAD}
24+
EndGlobalSection
25+
EndGlobal

src/UrlShortener.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Shortener/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

0 commit comments

Comments
 (0)