Skip to content

Commit

Permalink
fix local debug of api with front
Browse files Browse the repository at this point in the history
  • Loading branch information
Facundo De Lorenzo committed May 16, 2024
1 parent 7e8e80c commit 48a0e37
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "Debug challenge!",
"runtimeExecutable": "concurrently",
"runtimeArgs": [
"pnpm --filter api start:debug",
"pnpm --filter api start",
"pnpm --filter front start"
],
"autoAttachChildProcesses": true,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
]
},
"scripts": {
"dev:frontapi": "concurrently \"pnpm --filter api start:debug\" \"pnpm --filter front start\"",
"dev:frontapi": "concurrently \"pnpm --filter api start\" \"pnpm --filter front start\"",
"dev:front": "pnpm --filter front start",
"dev:api": "pnpm --filter api start",
"build:front": "pnpm --filter front build"
}
}
3 changes: 2 additions & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"license": "UNLICENSED",
"scripts": {
"build": "rm -rf dist && tsc -b",
"postbuild": "cp package.json dist/package.json"
"postbuild": "cp package.json dist/package.json",
"start": "sam build && sam local start-api -p 5000"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.137",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Resources:
Method: GET
Path: /products

createOrderFunction:
CreateOrderFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./dist
Expand Down
2 changes: 1 addition & 1 deletion packages/front/src/components/app/hooks/useGetProducts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const useGetProducts = () => {
const [products, setProducts] = useState<Product[]>([]);

useEffect(() => {
axios.get("http://localhost:5000/products").then((resp) => {
axios.get(`${process.env.REACT_APP_API_ENDPOINT}/products`).then((resp) => {
if (resp.data) setProducts(resp.data);
});
}, []);
Expand Down

0 comments on commit 48a0e37

Please sign in to comment.