A starting point for building universal/isomorphic React applications with ASP.NET Core 1, leveraging existing front-end approaches. Uses the JavaScriptViewEngine.
- Minimize .NET's usage - It's only usage should be for building REST endpoints (WebApi) and providing the initial state (pure POCO). No razor syntax anywhere.
- Isomorphic/universal rendering.
- Client and server should render using the same source files (javascript).
- Out-of-the-box login/register/manage functionality.
This approach is great for front-end developers because it gives them complete control to build their app as they like. No .NET crutches (bundling/razor). No opinions. No gotchas. Just another typical React client-side application, but with the initial state provided by ASP.NET for each URL.
To checkout this demo...
> cd src/React
> npm install
> gulp
> dnu restore
> dnx ef database update
> dnx web
Some of the branches in this repo that are maintained:
master
- This is the main branch. It has all the stuff required to get you started, including membership, external logins (OAuth) and account management.empty-template
- This branch for people that want an empty template with the absolute minimum recommend boilerplate for any ASP.NET React application.
There isn't really a "New Project" template for this. For now, download this repository and use it as your starting point. Then change your .sln and project names as you like.
- client.js and server.js - The entry point for the client-side/server-side applications.
- Html.js and App.js - These files essentially represent the "React" version of MVC Razor's "_Layout.cshtml".
- Controllers - The endpoints for a each initial GET request, and each client-side network request.
I will be adding features to this project as time goes on to help me get started with new React projects in .NET. So, expect some more things. I am also open to contributions or recommendations.
I intend to have this project be a clone of ASP.NET's default template (Visual Studio's "New > Project" template) with authentication (including OAuth providers) and account management.
I took a lot of things from react-redux-universal-hot-example, but not everything. As time goes on, expect to see more of the same patterns/technologies/techniques copied over.