File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,14 @@ The examples are compatible with [LTS versions of Node.js](https://github.com/no
88
99## Setup & Run
1010
11- 1 . Build :
11+ 1 . Go to ` src/feature-management ` under the root folder and run :
1212
1313 ``` bash
14+ npm run install
1415 npm run build
1516 ```
1617
17- 1. Install the dependencies using ` npm` :
18+ 1. Go back to ` examples/express-app ` and install the dependencies using ` npm` :
1819
1920 ` ` ` bash
2021 npm install
@@ -40,7 +41,9 @@ The targeting mechanism uses the `exampleTargetingContextAccessor` to extract th
4041const exampleTargetingContextAccessor = {
4142 getTargetingContext: () => {
4243 const req = requestAccessor.getStore ();
44+ // read user and groups from request query data
4345 const { userId, groups } = req.query;
46+ // return aa ITargetingContext with the appropriate user info
4447 return { userId: userId, groups: groups ? groups.split(" ," ) : [] };
4548 }
4649};
Original file line number Diff line number Diff line change 11{
22 "scripts" : {
3- "start" : " node server.mjs" ,
4- "build" : " cd ../../src/feature-management && npm i && npm run build && cd ../../examples/express-app && npm i"
3+ "start" : " node server.mjs"
54 },
65 "dependencies" : {
76 "@microsoft/feature-management" : " ../../src/feature-management" ,
Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ const requestAccessor = new AsyncLocalStorage();
1515const exampleTargetingContextAccessor = {
1616 getTargetingContext : ( ) => {
1717 const req = requestAccessor . getStore ( ) ;
18+ // read user and groups from request query data
1819 const { userId, groups } = req . query ;
20+ // return an ITargetingContext with the appropriate user info
1921 return { userId : userId , groups : groups ? groups . split ( "," ) : [ ] } ;
2022 }
2123} ;
You can’t perform that action at this time.
0 commit comments