Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pi.hub
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
iot
pi.hub
Commits
eccf5894
Commit
eccf5894
authored
Jun 16, 2017
by
artur.rachwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pi web server works
parent
104b8292
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
26 deletions
+27
-26
Pi.Hub.Api/Controllers/StatusController.cs
+10
-0
Pi.Hub.Api/Pi.Hub.Api.csproj
+4
-5
Pi.Hub.Api/Program.cs
+10
-9
Pi.Hub.Api/Startup.cs
+3
-12
No files found.
Pi.Hub.Api/Controllers/StatusController.cs
View file @
eccf5894
...
@@ -15,5 +15,15 @@ namespace Pi.Hub.Api.Controllers
...
@@ -15,5 +15,15 @@ namespace Pi.Hub.Api.Controllers
{
{
return
new
{
Now
=
DateTime
.
Now
.
ToString
(
"F"
)
};
return
new
{
Now
=
DateTime
.
Now
.
ToString
(
"F"
)
};
}
}
[
HttpPost
]
[
Route
(
"[action]"
)]
public
object
Echo
([
FromBody
]
object
obj
)
{
return
new
{
Echo
=
obj
};
}
}
}
}
}
Pi.Hub.Api/Pi.Hub.Api.csproj
View file @
eccf5894
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeIdentifiers>win-arm;linux-arm;x86</RuntimeIdentifiers>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
<Folder Include="wwwroot\" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
...
...
Pi.Hub.Api/Program.cs
View file @
eccf5894
...
@@ -2,8 +2,10 @@
...
@@ -2,8 +2,10 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Net
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.AspNetCore
;
using
Microsoft.AspNetCore.WebUtilities
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Hosting
;
namespace
Pi.Hub.Api
namespace
Pi.Hub.Api
...
@@ -12,15 +14,14 @@ namespace Pi.Hub.Api
...
@@ -12,15 +14,14 @@ namespace Pi.Hub.Api
{
{
public
static
void
Main
(
string
[]
args
)
public
static
void
Main
(
string
[]
args
)
{
{
var
host
=
new
WebHostBuilder
()
BuildWebHost
(
args
).
Run
();
.
UseKestrel
()
}
.
UseContentRoot
(
Directory
.
GetCurrentDirectory
())
.
UseIISIntegration
()
public
static
IWebHost
BuildWebHost
(
string
[]
args
)
=>
WebHost
.
CreateDefaultBuilder
(
args
)
.
UseStartup
<
Startup
>()
.
UseStartup
<
Startup
>()
.
Use
ApplicationInsights
(
)
.
Use
Kestrel
(
opt
=>
opt
.
Listen
(
IPAddress
.
Parse
(
"169.254.25.213"
),
5000
)
)
.
Build
();
.
Build
();
host
.
Run
();
}
}
}
}
}
Pi.Hub.Api/Startup.cs
View file @
eccf5894
...
@@ -12,31 +12,22 @@ namespace Pi.Hub.Api
...
@@ -12,31 +12,22 @@ namespace Pi.Hub.Api
{
{
public
class
Startup
public
class
Startup
{
{
public
Startup
(
I
HostingEnvironment
env
)
public
Startup
(
I
Configuration
configuration
)
{
{
var
builder
=
new
ConfigurationBuilder
()
Configuration
=
configuration
;
.
SetBasePath
(
env
.
ContentRootPath
)
.
AddJsonFile
(
"appsettings.json"
,
optional
:
false
,
reloadOnChange
:
true
)
.
AddJsonFile
(
$"appsettings.
{
env
.
EnvironmentName
}
.json"
,
optional
:
true
)
.
AddEnvironmentVariables
();
Configuration
=
builder
.
Build
();
}
}
public
IConfiguration
Root
Configuration
{
get
;
}
public
IConfiguration
Configuration
{
get
;
}
// This method gets called by the runtime. Use this method to add services to the container.
// This method gets called by the runtime. Use this method to add services to the container.
public
void
ConfigureServices
(
IServiceCollection
services
)
public
void
ConfigureServices
(
IServiceCollection
services
)
{
{
// Add framework services.
services
.
AddMvc
();
services
.
AddMvc
();
}
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public
void
Configure
(
IApplicationBuilder
app
,
IHostingEnvironment
env
,
ILoggerFactory
loggerFactory
)
public
void
Configure
(
IApplicationBuilder
app
,
IHostingEnvironment
env
,
ILoggerFactory
loggerFactory
)
{
{
loggerFactory
.
AddConsole
(
Configuration
.
GetSection
(
"Logging"
));
loggerFactory
.
AddDebug
();
app
.
UseMvc
();
app
.
UseMvc
();
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment