-
-
Notifications
You must be signed in to change notification settings - Fork 5
Backend development
Normally when you run dotnet run
it starts ng serve
for you. This works great if you are developing on the front end as it watches for file changes and reloads your browser once it has compiled.
If you are developing on the backend this works better
cd src/SIL.XForge.Scripture/
dotnet watch run --start-ng-serve=listen
In another terminal
cd src/SIL.XForge.Scripture/ClientApp/
ng serve
When files change on the backend it will compile the changes automatically and now ng serve
won't re-start every time.
See the Debugging section below for how to do this in VS Code.
The Angular app has a dependency on the Node backend NPM package so that it has access to the model types. If the models are changed, the Angular app will not see the changes until the backend package is rebuilt. You can rebuild the backend by executing the following commands:
cd src/RealtimeServer/
npm run build
If a model change is made, then a corresponding data migration should be implemented in the Node backend. A data migration is implemented by following these steps:
- Create a class that extends the
Migration
base class with the name<collection>Migration<version>
in the appropriate collection migrations file. For example, if you are adding a user migration for schema version 10, then you would add the classUserMigration10
to thesrc/RealtimeServer/common/services/user-migrations.ts
file. - Implement the
migrateDoc
method. ThesubmitMigrationOp
function MUST be used to submit any migration changes to the doc. - Implement the
migrateOp
method. - Add the class to the migrations array in the migrations file.