The Exit Survey Administration Tool will assist BC Stats in administering the BCPS Exit Survey.
- Ensure the .NET SDK 8.0 is installed.
- Ensure the .NET HTTPS development certificate is trusted.
- Install Postgres and create a
database named
esa. - Check out the code from this repository.
NB. To be fully functional, the application should be run in conjunction with the CallWeb API. The code for the CallWeb API is not publicly available. Please reach out to the project team for access. However, the project will still build and run without the CallWeb API.
- Install EF Core dependencies
dotnet tool install dotnet-ef --version 8.0.15
dotnet add package Microsoft.EntityFrameworkCore --version 8.0.15
dotnet add package Microsoft.EntityFrameworkCore.Design --version 8.0.15
The application uses two appsettings.json files, one in the /config directory and one in /secret. This mirrors how the application gets deployed to OpenShift. /config/appsettings.json contains non-sensitive configuration for the application, while /secret/appsettings.json contains configuration that should not readily visible.
See also the comments in Program.cs about how the files get resolved when the application is deployed to OpenShift.
To get set up:
-
Copy the contents of
/config/appsettings.config-template.jsoninto a new file,/config/appsettings.json, and update the values as appropriate. -
Do the same with
/secret/appsettings.secret-template.json, copying it into/secret/appsettings.json. -
We also need to set up the frontend environment. In the
/frontenddirectory, copy/frontend/public/config/__ENV.js.templateto/frontend/public/config/__ENV.js, and update the values as appropriate for your local development environment.
- From the root project directory, run
dotnet ef database update. This will run the migrations and set up your development database.
Note that the database will be seeded automatically when the application is started.
- Open the root code directory in Visual Studio Code. You may be prompted to add required assets and/or resolve dependencies; do so.
- While in Visual Studio Code, press CTRL + F5 to launch the API.
- Test that the API is running correctly by checking the HealthStatus. If
the project is running at the default location and port:
curl http://localhost:5050/api/HealthStatus/Status.
- From the
/frontenddirectory runyarn install.
- Still in the
/frontenddirectory, runyarn devto launch the front-end. You should see the application open in a new browser.
- The frontend was migrated from Create React App (CRA) to Vite for improved performance and developer experience.
- See
frontend/README.mdfor updated instructions and migration notes. - Use
yarn dev/yarn build/yarn previewin/frontendfor frontend development and builds. - Runtime configuration is loaded from
__ENV.js(created from__ENV.js.templatefor local development). - CRA-specific scripts and files are obsolete and can be removed if not needed.
The following sample documents should be placed in the /SampleInput folder, and can be obtained from the project team.
PSA-CSV-Sample.csvCallWeb-Sample.csv
This command will quickly drop the database, delete migrations, create an initial migration, and update the database.
dotnet ef database drop --force;rm -rf Migrations/*.cs;dotnet ef migrations add InitialCreate;dotnet ef database update
Copyright 2019 Province of British Columbia
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.