The account microservice is a bit different from the other ones, since it uses Edge.js in production to to in-process communication between .NET and node.js.
When developing in this repos with only frontend, we run it using an express server. This is fine
for testing individual pages and some API flows, but doesn't supply the logged in state from the
Identity Server from .NET. You can add mock parameters int the URL to fake a certain state
(explained in `account/mock/README.md), but to test it properly you need to start account from
Visual Studio.
Prerequisites:
Make sure you clone the slimmingworld.platform and slimmingworld.platform.frontend repos in the
same parent folder and use the default repo folder names.
So the folder names must be:
<folder>/slimmingworld.platform/<folder>/slimmingworld.platform.frontend/
Install yarn (npm install yarn) if needed.
Backend
Edge.js rendering is switched on using the application configuration setting account.useedge.
The rest of the debug and run process is the same as usual. To run edge locally, the following system environment variables must be set:
| variable | value |
|---|---|
| EDGE_DEBUG | true |
| EDGE_ENABLE_SCRIPTIGNOREATTRIBUTE | true |
| EDGE_MARSHAL_ENUM_AS_INT | true |
| NODE_ENV | localhost |
Running
Frontend
When frontend code has changed:
- cd
/slimmingworld.platform.frontend/ yarn installyarn set-dev-market -- <market>to set the market (uk/us)yarn edge:<market>
The last step will do a frontend build and copy over all required files in the correct account
project. It will not copy over the node_modules, for that you will need to follow the steps below.
When node modules have changed:
- Copy
yarn.lockandpackage.jsonfrom/slimmingworld.platform.frontend/to/slimmingworld.platform/src/SlimmingWorld.Platform.Account.Web/App_Data cd /slimmingworld.platform/src/SlimmingWorld.Platform.Account.Web/App_Datayarn install --prefer-offline --ignore-scripts --ignore-optional --production --frozen-lockfile
After this you can run the backend project.
For login, make sure you are running the member site as well, since the login system redirects to member and back to login to ensure that the openid connect data is passed through correctly.
Go to http://localhost:8080 and you should see the login page.
For the forgotten password page go to http://localhost:8080/forgot-password.
Note: Each time you make a change in the frontend code, you need to rerun the build and copy the files across as detailed above. The .NET app needs to be stopped and started anytime the frontend code is changed.