oc-template-elm-compiler 0.1.0-beta.3 → 0.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -12,23 +12,20 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"parameters": {
|
|
15
|
-
"
|
|
16
|
-
"default":
|
|
17
|
-
"description": "
|
|
18
|
-
"example":
|
|
19
|
-
"mandatory":
|
|
20
|
-
"type": "
|
|
15
|
+
"userId": {
|
|
16
|
+
"default": 1,
|
|
17
|
+
"description": "The user id from the user database",
|
|
18
|
+
"example": 1,
|
|
19
|
+
"mandatory": true,
|
|
20
|
+
"type": "number"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"
|
|
27
|
-
"@types/jest": "*",
|
|
28
|
-
"@types/react": "*",
|
|
29
|
-
"enzyme": "^3.11.0",
|
|
26
|
+
"oc-server": "*",
|
|
30
27
|
"oc-template-elm-compiler": "*",
|
|
31
28
|
"elm": "*",
|
|
32
29
|
"typescript": "*"
|
|
33
30
|
}
|
|
34
|
-
}
|
|
31
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Server } from 'oc-server';
|
|
2
|
+
|
|
1
3
|
const database = [
|
|
2
4
|
{ name: 'John Doe', email: 'john@doe.com', age: 32 },
|
|
3
5
|
{ name: 'Jane Doe', email: 'jane@doe.com', age: 31 }
|
|
@@ -7,15 +9,14 @@ async function getUser(userId: number) {
|
|
|
7
9
|
return database[userId];
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
export
|
|
11
|
-
const { moreData } =
|
|
12
|
-
const userId = Number(context.params.userId || 0);
|
|
12
|
+
export const server = new Server(async (params: { userId: number; moreData?: boolean }) => {
|
|
13
|
+
const { moreData, userId } = params;
|
|
13
14
|
const { email, name, age } = await getUser(userId);
|
|
14
15
|
|
|
15
|
-
return
|
|
16
|
+
return {
|
|
16
17
|
userId,
|
|
17
18
|
name,
|
|
18
19
|
email,
|
|
19
20
|
age: moreData && age
|
|
20
|
-
}
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
|
+
});
|
|
File without changes
|