Skip to content

Commit 61ad1f7

Browse files
committed
feat: Update Nginx configuration for API routing and error handling; enhance styles for quantity input
1 parent 3ba939e commit 61ad1f7

File tree

5 files changed

+90
-26
lines changed

5 files changed

+90
-26
lines changed

src/store-admin/nginx.conf

Lines changed: 73 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,82 @@ server {
2020
return 200 '{"status":"ok","version":"${APP_VERSION}"}';
2121
}
2222

23-
# Proxy API requests to the appropriate services
23+
#error_page 404 /404.html;
24+
25+
# redirect server error pages to the static page /50x.html
26+
#
27+
error_page 500 502 503 504 /50x.html;
28+
location = /50x.html {
29+
root /usr/share/nginx/html;
30+
}
31+
32+
location ~ ^/api/makeline/order/(?<id>\w+) {
33+
proxy_pass http://makeline-service:3001/order/$id;
34+
proxy_http_version 1.1;
35+
}
36+
37+
location /api/makeline/order {
38+
proxy_pass http://makeline-service:3001/order;
39+
proxy_http_version 1.1;
40+
}
41+
42+
location /api/makeline/order/fetch {
43+
proxy_pass http://makeline-service:3001/order/fetch;
44+
proxy_http_version 1.1;
45+
}
46+
47+
location /api/order {
48+
proxy_pass http://order-service:3000/;
49+
proxy_http_version 1.1;
50+
}
51+
52+
location /api/products/ {
53+
proxy_pass http://product-service:3002/;
54+
proxy_http_version 1.1;
55+
}
56+
2457
location /api/products {
25-
proxy_pass ${PRODUCT_SERVICE_URL};
26-
proxy_set_header Host $host;
27-
proxy_set_header X-Real-IP $remote_addr;
28-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
29-
proxy_set_header X-Forwarded-Proto $scheme;
58+
proxy_pass http://product-service:3002/;
59+
proxy_http_version 1.1;
60+
}
61+
62+
# location ~* ^/api/products {
63+
# proxy_pass http://product-service:3002/;
64+
# proxy_http_version 1.1;
65+
# }
66+
67+
location ~ ^/api/product/(?<id>\w+) {
68+
proxy_pass http://product-service:3002/$id;
69+
proxy_http_version 1.1;
70+
}
71+
72+
# location ~* ^/api/product {
73+
# proxy_pass http://product-service:3002/;
74+
# proxy_http_version 1.1;
75+
# }
76+
77+
location /api/product {
78+
proxy_pass http://product-service:3002/;
79+
proxy_http_version 1.1;
80+
}
81+
82+
location /api/product/ {
83+
proxy_pass http://product-service:3002/;
84+
proxy_http_version 1.1;
3085
}
3186

32-
location /api/makeline {
33-
proxy_pass ${MAKELINE_SERVICE_URL};
34-
proxy_set_header Host $host;
35-
proxy_set_header X-Real-IP $remote_addr;
36-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
37-
proxy_set_header X-Forwarded-Proto $scheme;
87+
location /api/ai/health {
88+
proxy_pass http://product-service:3002/ai/health;
89+
proxy_http_version 1.1;
3890
}
3991

40-
error_page 404 /index.html;
92+
location /api/ai/generate/description {
93+
proxy_pass http://product-service:3002/ai/generate/description;
94+
proxy_http_version 1.1;
95+
}
96+
97+
location /api/ai/generate/image {
98+
proxy_pass http://product-service:3002/ai/generate/image;
99+
proxy_http_version 1.1;
100+
}
41101
}

src/store-front/nginx.conf

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,13 @@ server {
2222

2323
# Proxy API requests to the appropriate services
2424
location /api/products {
25-
proxy_pass ${PRODUCT_SERVICE_URL};
26-
proxy_set_header Host $host;
27-
proxy_set_header X-Real-IP $remote_addr;
28-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
29-
proxy_set_header X-Forwarded-Proto $scheme;
25+
proxy_pass http://product-service:3002/;
26+
proxy_http_version 1.1;
3027
}
3128

32-
location /api/order {
33-
proxy_pass ${ORDER_SERVICE_URL}v1/order;
34-
proxy_set_header Host $host;
35-
proxy_set_header X-Real-IP $remote_addr;
36-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
37-
proxy_set_header X-Forwarded-Proto $scheme;
29+
location /api/orders {
30+
proxy_pass http://order-service:3000/;
31+
proxy_http_version 1.1;
3832
}
3933

4034
error_page 404 /index.html;

src/store-front/src/assets/styles.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ nav a:hover {
180180
margin: 1rem 0;
181181
}
182182

183+
/* Form Controls */
184+
.quantity-input {
185+
width: 50px;
186+
height: 30px;
187+
border: 1px solid #ccc;
188+
border-radius: 5px;
189+
padding: 5px;
190+
margin-right: 10px;
191+
}
192+
183193
/* Responsive design */
184194
@media (max-width: 768px) {
185195
.container {

src/store-front/src/components/ProductCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</div>
1010
<div class="product-controls">
1111
<input type="number" v-model="quantity" min="1" class="quantity-input" />
12-
<button @click="addToCart">Add to Cart</button>
12+
<button class="button" @click="addToCart">Add to Cart</button>
1313
</div>
1414
</div>
1515
</div>

src/store-front/src/views/ProductDetailView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
>
1515
</p>
1616
<input type="number" v-model="quantity" min="1" class="quantity-input" />
17-
<button @click="addToCart">Add to Cart</button>
17+
<button class="button" @click="addToCart">Add to Cart</button>
1818
</div>
1919
</div>
2020
</div>

0 commit comments

Comments
 (0)