-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
90 lines (84 loc) · 1.96 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
service: search-service
plugins:
- serverless-aws-documentation
- serverless-plugin-typescript
- serverless-reqvalidator-plugin
- serverless-plugin-log-retention
provider:
name: aws
runtime: nodejs14.x
region: ${env:REGION}
useDotenv: true
functions:
default:
handler: src/index.default
memorySize: 128
events:
- http:
path: /search
method: post
cors:
origins:
- "*"
headers:
- Content-Type
reqValidatorName: SearchRequestValidator
documentation:
requestModels:
application/json: VideoSearchRequest
environment:
API_KEY: ${env:API_KEY}
resources:
Resources:
SearchRequestValidator:
Type: AWS::ApiGateway::RequestValidator
Properties:
RestApiId:
Ref: ApiGatewayRestApi
ValidateRequestBody: true
ValidateRequestParameters: false
custom:
logRetentionInDays: 7
documentation:
api:
info:
version: "1.0.0"
title: Video Search API
models:
- name: VideoSearchRequest
contentType: application/json
schema:
required:
- query
- provider
properties:
query:
type: string
provider:
type: string
enum:
- YouTube
- name: VideoSearchResponse
contentType: application/json
schema:
type: array
items:
type: object
required:
- url
- thumbnailUrl
- title
properties:
url:
type: string
thumbnailUrl:
type: string
title:
type: string
- name: 400JsonResponse
contentType: "application/json"
schema:
type: object
properties:
message:
type: string