Generate a New Application
Reading
Generate a new app
For this full-stack application, we'll be using the last of the SDG dotnet
templates, sdg-react
. This app includes:
The sdg-react template generates a full React application in the directory
ClientApp
and ensures connectivity to the C# backend application found in the
rest of the directories.
Generate the app
From your command line in the directory where you've stored your other assignments, execute the following command
(replace MyApp with your application name, e.g. TacoTuesday
)
dotnet new sdg-react-no-client-app -o MyApp
Generate a ClientApp
After doing a cd
to change directory into your project's folder (e.g.
cd TacoTuesday
) you can generate your client app.
degit YOUR-GITHUB-ACCOUNT-HERE/react-project-template ClientApp
git add .
git commit -m "Initial Commit"
Running the application
You'll need two terminal/PowerShell to run the app. In the first window:
dotnet watch run
and then in the second:
(You may need to cd
again to your project if the new terminal/PowerShell
starts in your "home" folder)
cd ClientAppnpm start
Visit your app
Open your browser and visit http://localhost:5000
, this is the URL we will use
to view our full stack web application.
Setting the JWT Key
You may see a page that says: You do not have a valid JWT_KEY.
To resolve this warning, follow the instructions on the screen, restart
dotnet watch run
and reload your browser at http://localhost:5000
-- You
should see your default front end template's content.