Last active
January 21, 2017 12:38
-
-
Save MikaelPorttila/91f8650bf8a54e3615a4798e54030d04 to your computer and use it in GitHub Desktop.
Nancy 2.0 + Aurelia setup guide
This file contains hidden or 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
1. Create new empty NetCore Web project using dotnet cli or Visual Studio 2017. | |
2. Run following nuget cmds + update existing nuget-packages to latest and greatest: | |
Install-Package Nancy -Pre | |
Install-Package Microsoft.AspNetCore.Owin | |
Install-Package Microsoft.AspNetCore.StaticFiles | |
3. Append the Configure method in Startup.cs with: | |
app.UseDefaultFiles(); | |
app.UseStaticFiles(); | |
app.UseOwin(x => x.UseNancy()); | |
TODO: setup npm, download aurelia cli, use AU-cli to setup new instance. | |
... | |
!! If using csproj !! | |
- Edit the csproj, add following in PropertyGroup: | |
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> | |
Aurelia project modifications: | |
1. Open aurelia.json and modify: | |
- platform output from "scripts" to "wwwroot\\scripts" | |
- build target output from "scripts" to "wwwroot\\scripts" | |
- build target index from "index.html" to "wwwroot\\index.html" | |
BrowerSync modification and proxy setup: | |
This step allows browsersync to proxy API calls to the backend. | |
1. Modify the baseDir in run.ts from baseDir: ['.'] to baseDir: ['./wwwroot'] | |
2. add following code: | |
import * as proxy from 'http-proxy-middleware'; | |
proxy("/api", { target: 'http://localhost:5000/api', cookieRewrite: true, pathRewrite: { "^/api": "" } }), | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment