Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

#### What was done

1. Task 2.1: Manual Deployment
2. Task 2.2: Automated Deployment
Attempted to connect product APIs but somehow it isn't working

### Links for Task #2
- CloudFront URL (this one should work): https://d2s4vtjjdp7wcf.cloudfront.net/
- S3-website URL (this one should give 403 Forbidden error): https://shop-react-redux-cloudfront-sujit.s3.ap-south-1.amazonaws.com/
FE App: https://d2s4vtjjdp7wcf.cloudfront.net/
BE PR: https://github.com/sujit-epam/jscc-aws-backend/pull/1
7 changes: 2 additions & 5 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ frameworkVersion: "3"
provider:
name: aws
runtime: nodejs14.x
region: eu-west-1
region: ap-south-1
# setup profile for AWS CLI.
# profile: node-aws

Expand Down Expand Up @@ -102,10 +102,7 @@ resources:
CachedMethods: ["GET", "HEAD", "OPTIONS"]
ForwardedValues:
Headers:
- Access-Control-Request-Headers
- Access-Control-Request-Method
- Origin
- Authorization
- Access-Control-Allow-Origin *
## Defining if and how the QueryString and Cookies are forwarded to the origin which in this case is S3
QueryString: false
Cookies:
Expand Down
10 changes: 5 additions & 5 deletions src/constants/apiPaths.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const API_PATHS = {
product: "https://.execute-api.eu-west-1.amazonaws.com/dev",
order: "https://.execute-api.eu-west-1.amazonaws.com/dev",
import: "https://.execute-api.eu-west-1.amazonaws.com/dev",
bff: "https://.execute-api.eu-west-1.amazonaws.com/dev",
cart: "https://.execute-api.eu-west-1.amazonaws.com/dev",
product: "https://.execute-api.us-east-1.amazonaws.com/product",
order: "https://.execute-api.us-east-1.amazonaws.com/dev",
import: "https://.execute-api.us-east-1.amazonaws.com/dev",
bff: "https://9hm5ojtl48.execute-api.us-east-1.amazonaws.com/dev",
cart: "https://.execute-api.us-east-1.amazonaws.com/dev",
};

export default API_PATHS;
2 changes: 1 addition & 1 deletion src/mocks/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AvailableProduct, Product } from "~/models/Product";

export const handlers = [
rest.get(`${API_PATHS.bff}/product`, (req, res, ctx) => {
return res(ctx.status(200), ctx.delay(), ctx.json<Product[]>(products));
return res(ctx.status(200), ctx.delay(), ctx.json<Product[]>([]));
}),
rest.put(`${API_PATHS.bff}/product`, (req, res, ctx) => {
return res(ctx.status(200));
Expand Down
4 changes: 2 additions & 2 deletions src/queries/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function useAvailableProducts() {
"available-products",
async () => {
const res = await axios.get<AvailableProduct[]>(
`${API_PATHS.bff}/product/available`
`${API_PATHS.bff}/products`
);
return res.data;
}
Expand All @@ -29,7 +29,7 @@ export function useAvailableProduct(id?: string) {
["product", { id }],
async () => {
const res = await axios.get<AvailableProduct>(
`${API_PATHS.bff}/product/${id}`
`${API_PATHS.bff}/products/${id}`
);
return res.data;
},
Expand Down