Using Create React App with ASP.NET Core

Make sure you have already set ASP.NET Core app (Getting Started) and React.js app (Getting Started)

To use ASP.NET Core API from React.js app add option proxy to package.json

...
"proxy":"http://localhost:5000"
...

This option allow to proxy requests starts with /api to your API server (ASP.NET Core app).

More info about proxy option Proxying API Requests in Development

Start your apps

dotnet run
npm start

Full example of this approach AspNetCoreDemoApp

Ensure https for ASP.NET Core apps on Heroku

Update ConfigureServices method with:

Update Configure method with:

More info

Docker deployment using Bitbucket Pipelines and Heroku

Set HEROKU_TOKEN and APP_NAME at Settings -> Pipelines -> Environment variables.

bitbucket-pipelines.yml

deploy.sh

November update of my github projects

Dotnetcore Buildpack

dotnetcore-buildpack

  • Removed dotnet restore step
  • Extremely optimized slag size (DOTNET_SKIP_FIRST_TIME_EXPERIENCE:1)
  • Updated .NET Core SDK 2.0.3
  • Added support PROJECT_FILE and PROJECT_NAME environment variables (#23)

ASP.NET Core Demo App

AspNet5DemoApp

  • Updated npm modules and nuget packages
  • Added react-scripts
  • Added Dockerfile and License

Jincod.CQRS

Jincod.CQRS

  • Updated .NET Core to 2.0.0
  • Updated nuget package to 2.0.1

Build scripts

build-scripts

  • Fixed setup script
  • Added Cake.Bakery to pacakges.config

Strongly Typed Web API Example

Jincod.CQRS

  • Created project for demonstration creating API Controllers using interfaces of services with Refit attributes.

Jenkins integration with Jest

We will use Jest-junit test reporter to integrate jest results with Jenkins.

Installation

npm install -D jest jest-junit

Configuration

Add to package.json:

"scripts": {
  ...
  "test": "jest"
}

Add to Jenkinsfile:

stage ('tests') {
  withEnv(["JEST_JUNIT_OUTPUT=./jest-test-results.xml"]) {
    sh 'npm test -- --ci --testResultsProcessor="jest-junit"'
  }
  junit 'jest-test-results.xml'
}