Skip to content

Commit 8e09b18

Browse files
committed
Postman collection
1 parent 3994d0b commit 8e09b18

File tree

2 files changed

+243
-0
lines changed

2 files changed

+243
-0
lines changed

postman/postman_collection.json

+198
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
{
2+
"info": {
3+
"_postman_id": "537f31f6-9cc8-4f30-93e9-7252cf66b172",
4+
"name": "Fastify Prisma",
5+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
6+
"_exporter_id": "29865378"
7+
},
8+
"item": [
9+
{
10+
"name": "Customer",
11+
"item": [
12+
{
13+
"name": "Create customer",
14+
"event": [
15+
{
16+
"listen": "prerequest",
17+
"script": {
18+
"exec": [
19+
"let firstName = pm.variables.replaceIn(\"{{$randomFirstName}}\")",
20+
"let lastName = pm.variables.replaceIn(\"{{$randomFirstName}}\")",
21+
"",
22+
"pm.environment.set(\"name\", `${firstName} ${lastName}`)",
23+
"pm.environment.set(\"password\", pm.variables.replaceIn('{{$randomPassword}}'))",
24+
"pm.environment.set(\"email\", `${firstName.toLowerCase()}.${lastName.toLowerCase()}@example.com`)",
25+
""
26+
],
27+
"type": "text/javascript"
28+
}
29+
}
30+
],
31+
"request": {
32+
"method": "POST",
33+
"header": [],
34+
"body": {
35+
"mode": "raw",
36+
"raw": "{\n \"email\": \"{{email}}\",\n \"name\": \"{{name}}\",\n \"password\": \"{{password}}\"\n}",
37+
"options": {
38+
"raw": {
39+
"language": "json"
40+
}
41+
}
42+
},
43+
"url": {
44+
"raw": "{{host}}/api/customers",
45+
"host": ["{{host}}"],
46+
"path": ["api", "customers"]
47+
}
48+
},
49+
"response": []
50+
},
51+
{
52+
"name": "Get customers",
53+
"request": {
54+
"auth": {
55+
"type": "bearer",
56+
"bearer": [
57+
{
58+
"key": "token",
59+
"value": "{{accessToken}}",
60+
"type": "string"
61+
}
62+
]
63+
},
64+
"method": "GET",
65+
"header": [],
66+
"url": {
67+
"raw": "{{host}}/api/customers",
68+
"host": ["{{host}}"],
69+
"path": ["api", "customers"]
70+
}
71+
},
72+
"response": []
73+
},
74+
{
75+
"name": "Customer Login",
76+
"event": [
77+
{
78+
"listen": "test",
79+
"script": {
80+
"exec": [
81+
"var jsonData = JSON.parse(responseBody);",
82+
"postman.setEnvironmentVariable(\"accessToken\", jsonData.accessToken)"
83+
],
84+
"type": "text/javascript"
85+
}
86+
}
87+
],
88+
"request": {
89+
"method": "POST",
90+
"header": [],
91+
"body": {
92+
"mode": "raw",
93+
"raw": "{\n \"email\": \"{{email}}\",\n \"password\": \"{{password}}\"\n}",
94+
"options": {
95+
"raw": {
96+
"language": "json"
97+
}
98+
}
99+
},
100+
"url": {
101+
"raw": "{{host}}/api/customers/login",
102+
"host": ["{{host}}"],
103+
"path": ["api", "customers", "login"]
104+
}
105+
},
106+
"response": []
107+
}
108+
]
109+
},
110+
{
111+
"name": "Product",
112+
"item": [
113+
{
114+
"name": "Create product",
115+
"event": [
116+
{
117+
"listen": "prerequest",
118+
"script": {
119+
"exec": [""],
120+
"type": "text/javascript"
121+
}
122+
}
123+
],
124+
"request": {
125+
"auth": {
126+
"type": "bearer",
127+
"bearer": [
128+
{
129+
"key": "token",
130+
"value": "{{accessToken}}",
131+
"type": "string"
132+
}
133+
]
134+
},
135+
"method": "POST",
136+
"header": [],
137+
"body": {
138+
"mode": "raw",
139+
"raw": "{\n \"title\": \"A cool product\",\n \"price\": 14.99,\n \"content\": \"This is actually an sick product\"\n}",
140+
"options": {
141+
"raw": {
142+
"language": "json"
143+
}
144+
}
145+
},
146+
"url": {
147+
"raw": "{{host}}/api/products",
148+
"host": ["{{host}}"],
149+
"path": ["api", "products"]
150+
}
151+
},
152+
"response": []
153+
},
154+
{
155+
"name": "Get products",
156+
"request": {
157+
"auth": {
158+
"type": "bearer",
159+
"bearer": [
160+
{
161+
"key": "token",
162+
"value": "{{accessToken}}",
163+
"type": "string"
164+
}
165+
]
166+
},
167+
"method": "GET",
168+
"header": [],
169+
"url": {
170+
"raw": "{{host}}/api/products",
171+
"host": ["{{host}}"],
172+
"path": ["api", "products"]
173+
}
174+
},
175+
"response": []
176+
}
177+
]
178+
},
179+
{
180+
"name": "Healthcheck",
181+
"item": [
182+
{
183+
"name": "App healthcheck",
184+
"request": {
185+
"method": "GET",
186+
"header": [],
187+
"url": {
188+
"raw": "{{host}}/healthcheck",
189+
"host": ["{{host}}"],
190+
"path": ["healthcheck"]
191+
}
192+
},
193+
"response": []
194+
}
195+
]
196+
}
197+
]
198+
}

postman/postman_environment.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"id": "2220c3d7-1db3-4b69-a9f0-11880dd34b0f",
3+
"name": "Fastify Prisma",
4+
"values": [
5+
{
6+
"key": "host",
7+
"value": "http://localhost:5000",
8+
"type": "default",
9+
"enabled": true
10+
},
11+
{
12+
"key": "email",
13+
"value": "",
14+
"type": "default",
15+
"enabled": true
16+
},
17+
{
18+
"key": "name",
19+
"value": "",
20+
"type": "default",
21+
"enabled": true
22+
},
23+
{
24+
"key": "password",
25+
"value": "",
26+
"type": "default",
27+
"enabled": true
28+
},
29+
{
30+
"key": "accessToken",
31+
"value": "",
32+
"type": "any",
33+
"enabled": true
34+
},
35+
{
36+
"key": "refreshToken",
37+
"value": "",
38+
"type": "any",
39+
"enabled": true
40+
}
41+
],
42+
"_postman_variable_scope": "environment",
43+
"_postman_exported_at": "2023-10-28T10:34:45.295Z",
44+
"_postman_exported_using": "Postman/10.19.6"
45+
}

0 commit comments

Comments
 (0)