Simple contact CRUD demo application using React hooks and ASP.NET Core
Yep, “yet another” contact management React application, but this one shows how to
implement functional components with React hooks for state management instead of Redux, because Redux + class based components
are so 2018! Additionally, it leverages the latest features in .NET Core 2.2 on the backend.
While the application use case is very simple, the intention is to
demonstrate how different architecture patterns and design principles can be integrated
to support scalability.
You will need the following tools:
IMPORTANT:
There is a bug in SQL Server 2017 Express LocalDb that throws an exception when creating a new database as
explained here. If
you have this issue, you will have to install the SQL Server 2017 Cumulative Patch 6 available here.
Follow these steps to get your development environment set up:
The solution uses SPA extensions therefore backend and front-end are wired to run together. The backend uses EF migrations, so the database will be created and seeded with a few records.
If for some reason the database is not created automatically, you can run the SQL scripts located in /database folder in the order they are named after.
dotnet restore
dotnet build
Next, within the jvContacts.Web.React\ClientApp
directory, launch the front end by running:
yarn start
or
npm start
Note that this will launch a browser in the next available port. You can close this browser because the one connected to the API is the one from dotnet.
Once the front end has started, within the jvContacts.Web.React
directory, launch the back end by running:
dotnet run
If you get an error about the database, check your connection string in the appsettings.json file to make sure it points to your local database.
REMINDER: This is a proof of concept for how an enterprise application could be built
using these technologies. It is not a production-ready application. It uses third party tools that are still in beta