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
8
8
9
9
## Setup & Run
10
10
11
- 1 . Build :
11
+ 1 . Go to ` src/feature-management ` under the root folder and run :
12
12
13
13
``` bash
14
+ npm run install
14
15
npm run build
15
16
```
16
17
17
- 1. Install the dependencies using ` npm` :
18
+ 1. Go back to ` examples/express-app ` and install the dependencies using ` npm` :
18
19
19
20
` ` ` bash
20
21
npm install
@@ -40,7 +41,9 @@ The targeting mechanism uses the `exampleTargetingContextAccessor` to extract th
40
41
const exampleTargetingContextAccessor = {
41
42
getTargetingContext: () => {
42
43
const req = requestAccessor.getStore ();
44
+ // read user and groups from request query data
43
45
const { userId, groups } = req.query;
46
+ // return aa ITargetingContext with the appropriate user info
44
47
return { userId: userId, groups: groups ? groups.split(" ," ) : [] };
45
48
}
46
49
};
Original file line number Diff line number Diff line change 1
1
{
2
2
"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"
5
4
},
6
5
"dependencies" : {
7
6
"@microsoft/feature-management" : " ../../src/feature-management" ,
Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ const requestAccessor = new AsyncLocalStorage();
15
15
const exampleTargetingContextAccessor = {
16
16
getTargetingContext : ( ) => {
17
17
const req = requestAccessor . getStore ( ) ;
18
+ // read user and groups from request query data
18
19
const { userId, groups } = req . query ;
20
+ // return an ITargetingContext with the appropriate user info
19
21
return { userId : userId , groups : groups ? groups . split ( "," ) : [ ] } ;
20
22
}
21
23
} ;
You can’t perform that action at this time.
0 commit comments