You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=> You need to have access to AWS to upload the solution.
60
+
2. execute command
54
61
55
-
```bash
56
-
aws sts get-caller-identity
57
-
```
62
+
```
63
+
jsonsls run db.json
64
+
```
58
65
59
-
### 4. Update db.json file in root directory
60
66
61
-
- Root properties marked in **bold** are the generated endpoints of the API ([route generation and json validation is done via json-server](https://github.com/typicode/json-server))
=> With the next request a new db.json file will be created in the S3 Bucket
161
157
162
-
#### Change Stackname
163
-
164
-
[edit service property in serverless.yml (in root directory)](https://github.com/pharindoko/json-server-less-lambda/blob/66756961d960c44cf317ca307b097f595799a890/serverless.yml#L8)
165
-
166
-
#### Adapt settings in config/appconfig.yml file
158
+
#### Adapt settings
167
159
168
160
| Attribute | Description | Type | Default |
169
161
|---|---|---|---|
170
162
| readOnly | Make API readonly - all API - write operations are forbidden (http 403)) | string |false |
171
163
| enableSwagger | Enable swagger and swagger UI support | string | true |
172
164
| enableApiKeyAuth | Make your routes private by using an additional ApiKey | boolean | false |
173
-
| jsonFile | path of json file that will be used | string | db.json |
What`s my {route} ? -> see [json-server documentation](https://github.com/typicode/json-server)
231
214
232
-
## Develop locally with cloud resources
233
-
234
-
Use same components (S3, LowDB) as the lambda does but have code executed locally.
235
-
236
-
### 1. Add .env file to root folder
237
-
238
-
**Mind:** If you haven`t deployed the solution yet, please create a private S3-Bucket and .json - file manually or deploy the solution first to AWS via serverless framework<br>
239
-
**Mind:** This function requires that you have access to AWS (e.g. via credentials)
240
-
241
-
- Copy the .env file from .env.sample in the root folder
242
-
243
-
```bash
244
-
cp .env.sample .env
245
-
```
246
-
247
-
- Required: Adapt settings in .env file
248
-
249
-
| Attribute | Description | Type | Default |
250
-
|---|---|---|---|
251
-
| S3File | JSON file used as db to read and write (will be created with a default json value - customize in db.json) | string |db.json |
252
-
| S3Bucket | S3-Bucket - this bucket must already exist in AWS | string | json-server-less-lambda-dev |
253
-
| readOnly | all API - write operations are forbidden (http 403)) | boolean | false |
254
-
255
-
#### 2. Start solution
256
-
257
-
```bash
258
-
npm run dev
259
-
```
260
-
261
-
#### 3. Test your API
262
-
263
-
#### With Swagger
264
-
265
-
Open the {ENDPOINTURL}: http://localhost:3000/ that you received as output
266
-
267
-
#### With Curl
268
-
269
-
1. replace the url with the url provided by serverless (see above)
270
-
2. replace the {API - KEY} with the key you get from serverless (see above)
271
-
3. replace {route} at the end of the url e.g. with posts (default value)
0 commit comments