-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (34 loc) · 1.31 KB
/
index.js
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
import { buildResponse } from "./utils/utils";
const createUserPath = '/createuser';
const registerPath = '/register';
const loginPath = '/login';
const deleteUserPath = '/deleteuser';
const transferUser = '/transferuser';
const healthPath = '/health';
export const handler = async(event) => {
console.log('Request Event : ', event);
let response;
switch(true) {
case event.httpMethod === "GET" && event.path === healthPath:
response = buildResponse(200, {"message": "Health check passed!"});
break;
case event.httpMethod === "POST" && event.path === registerPath:
response = buildResponse(200);
break;
case event.httpMethod === "POST" && event.path === createUserPath:
response = buildResponse(200);
break;
case event.httpMethod === "POST" && event.path === loginPath:
response = buildResponse(200);
break;
case event.httpMethod === "POST" && event.path === deleteUserPath:
response = buildResponse(200);
break;
case event.httpMethod === "POST" && event.path === transferUser:
response = buildResponse(200);
break;
default:
response = buildResponse(404, "404 Path Not Found!");
}
return response;
}