Add initial serverless setup.
This commit is contained in:
13
serverless/package.json
Normal file
13
serverless/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "serverless",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"type": "commonjs"
|
||||
}
|
||||
73
serverless/serverless.yml
Normal file
73
serverless/serverless.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
service: esdp-api
|
||||
app: esdp-api-app
|
||||
frameworkVersion: "4"
|
||||
|
||||
stages:
|
||||
prod:
|
||||
# Enables observability in the prod stage
|
||||
observability: true
|
||||
|
||||
# Sepcify parameter values to be used in the prod stage
|
||||
params:
|
||||
es_endpoint: https://insurtechtoolkit.com
|
||||
domain: es.imex.online
|
||||
beta:
|
||||
# Enables observability in the prod stage
|
||||
observability: false
|
||||
|
||||
# Sepcify parameter values to be used in the prod stage
|
||||
params:
|
||||
es_endpoint: https://4284-79073.el-alt.com
|
||||
domain: beta.es.imex.online
|
||||
alpha:
|
||||
# Enables observability in the prod stage
|
||||
observability: false
|
||||
# Sepcify parameter values to be used in the prod stage
|
||||
params:
|
||||
es_endpoint: https://4284-79287.el-alt.com
|
||||
domain: alpha.es.imex.online
|
||||
dev:
|
||||
# Enables observability in the prod stage
|
||||
observability: false
|
||||
# Sepcify parameter values to be used in the prod stage
|
||||
params:
|
||||
es_endpoint: https://4284-79287.el-alt.com
|
||||
domain: alpha.es.imex.online
|
||||
|
||||
# params:
|
||||
# dev:
|
||||
# domain: dev.es.imex.online
|
||||
# alpha:
|
||||
# domain: alpha.es.imex.online
|
||||
# beta:
|
||||
# domain: beta.es.imex.online
|
||||
# prod:
|
||||
# domain: es.imex.online
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs22.x
|
||||
region: ca-central-1
|
||||
domain: ${param:domain}
|
||||
httpApi: # This creates a cheaper, faster "HTTP API" Gateway
|
||||
cors: true # Automatically configures CORS
|
||||
|
||||
functions:
|
||||
# Route 1: POST /scrub
|
||||
scrub:
|
||||
handler: src/handlers/scrub.handler
|
||||
environment:
|
||||
ES_ENDPOINT: ${param:es_endpoint}
|
||||
events:
|
||||
- httpApi:
|
||||
path: /scrub
|
||||
method: post
|
||||
# Route 1: POST /scrub
|
||||
emsupload:
|
||||
handler: src/handlers/emsupload.handler
|
||||
environment:
|
||||
ES_ENDPOINT: ${param:es_endpoint}
|
||||
events:
|
||||
- httpApi:
|
||||
path: /emsupload
|
||||
method: post
|
||||
15
serverless/src/handlers/emsupload.js
Normal file
15
serverless/src/handlers/emsupload.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// You can require shared code from the lib folder
|
||||
// const { dbConnect } = require('../lib/db');
|
||||
|
||||
exports.handler = async (event) => {
|
||||
// Path parameters are automatically parsed for you
|
||||
const userId = event.pathParameters.id;
|
||||
|
||||
return {
|
||||
statusCode: 200,
|
||||
body: JSON.stringify({
|
||||
message: `EMS Upload Path`,
|
||||
|
||||
})
|
||||
};
|
||||
};
|
||||
15
serverless/src/handlers/scrub.js
Normal file
15
serverless/src/handlers/scrub.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// You can require shared code from the lib folder
|
||||
// const { dbConnect } = require('../lib/db');
|
||||
|
||||
exports.handler = async (event) => {
|
||||
// Path parameters are automatically parsed for you
|
||||
|
||||
|
||||
return {
|
||||
statusCode: 200,
|
||||
body: JSON.stringify({
|
||||
message: `Scrub Path`,
|
||||
data: { id: 1, name: "Alice" }
|
||||
})
|
||||
};
|
||||
};
|
||||
0
serverless/src/lib/db.js
Normal file
0
serverless/src/lib/db.js
Normal file
Reference in New Issue
Block a user