Skip to content

Commit c6c21de

Browse files
authored
Merge pull request #18 from oslabs-beta/testingapp
Updated Docker Example ports
2 parents f701ca1 + 43c82cb commit c6c21de

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

examples/docker/default.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
server {
2-
listen 8080;
2+
listen 8000;
33
root /srv/www/static;
44
location / {
55
# We try to get static files from nginx first
66
# because node is not great at IO operations
77
try_files $uri $uri/ @frontend;
88
}
99
location @frontend {
10-
proxy_pass http://frontend:3000;
10+
proxy_pass http://frontend:3333;
1111
}
1212
location /orders/createorder {
1313
proxy_pass http://orders:7777;

examples/docker/docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515

1616
# Bind container and host machine to exposed port, 3000.
1717
ports:
18-
- '3000:3000'
18+
- '3333:3333'
1919

2020
volumes:
2121
- '/var/run/docker.sock:/var/run/docker.sock'
@@ -69,7 +69,7 @@ services:
6969
container_name: 'production_nginx'
7070

7171
ports:
72-
- '8080:8080'
72+
- '8000:8000'
7373

7474
volumes:
7575
- './frontend:/srv/www/static'

examples/docker/frontend/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ WORKDIR /app
33
COPY . .
44
RUN npm install
55
EXPOSE 3000
6-
EXPOSE 8080
6+
EXPOSE 8000
77
CMD ["node", "server.js"]

examples/docker/frontend/index.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
window.onload = () => {
22
// microservice1 - Books
33
const microservicePort = {
4-
3000: 'Frontend',
4+
3333: 'Frontend',
55
8888: 'Books',
66
7777: 'Orders',
77
5555: 'Customers',
@@ -37,7 +37,7 @@ window.onload = () => {
3737
};
3838

3939
book = JSON.stringify(book);
40-
fetch('http://localhost:8080/books/createbook', {
40+
fetch('http://localhost:8000/books/createbook', {
4141
method: 'POST',
4242
headers: { 'Content-Type': 'application/json' },
4343
body: book,
@@ -60,7 +60,7 @@ window.onload = () => {
6060
newDisplay.id = 'display';
6161
newDisplay.innerHTML = 'List of books';
6262
document.getElementById('container').appendChild(newDisplay);
63-
fetch('http://localhost:8080/books/getbooks', {
63+
fetch('http://localhost:8000/books/getbooks', {
6464
method: 'GET',
6565
})
6666
.then(res => res.json())
@@ -85,7 +85,7 @@ window.onload = () => {
8585
const newDisplay = document.createElement('ul');
8686
newDisplay.id = 'display';
8787
document.getElementById('container').appendChild(newDisplay);
88-
const url = new URL('http://localhost:8080/books/deletebook:id?');
88+
const url = new URL('http://localhost:8000/books/deletebook:id?');
8989
// const url = new URL('http://localhost:3000/books/deletebook:id?');
9090
url.searchParams.append('id', bookInDb._id);
9191

@@ -115,7 +115,7 @@ window.onload = () => {
115115
newDisplay.id = 'display';
116116
newDisplay.innerHTML = 'List of orders';
117117
document.getElementById('container').appendChild(newDisplay);
118-
fetch('http://localhost:8080/books/getordersinfo', {
118+
fetch('http://localhost:8000/books/getordersinfo', {
119119
method: 'GET',
120120
})
121121
.then(res => res.json())
@@ -149,7 +149,7 @@ window.onload = () => {
149149
address,
150150
};
151151
customer = JSON.stringify(customer);
152-
fetch('http://localhost:8080/customers/createcustomer', {
152+
fetch('http://localhost:8000/customers/createcustomer', {
153153
method: 'POST',
154154
headers: { 'Content-Type': 'application/json' },
155155
body: customer,
@@ -170,7 +170,7 @@ window.onload = () => {
170170
newDisplay.id = 'display';
171171
newDisplay.innerHTML = 'List of customers';
172172
document.getElementById('container').appendChild(newDisplay);
173-
fetch('http://localhost:8080/customers/getcustomers', {
173+
fetch('http://localhost:8000/customers/getcustomers', {
174174
method: 'GET',
175175
})
176176
.then(res => res.json())
@@ -191,7 +191,7 @@ window.onload = () => {
191191
const newDisplay = document.createElement('ul');
192192
newDisplay.id = 'display';
193193
document.getElementById('container').appendChild(newDisplay);
194-
const url = new URL('http://localhost:8080/customers/deletecustomer:id?');
194+
const url = new URL('http://localhost:8000/customers/deletecustomer:id?');
195195
url.searchParams.append('id', customerInDb._id);
196196
fetch(url, {
197197
method: 'DELETE',
@@ -218,7 +218,7 @@ window.onload = () => {
218218
newDisplay.innerHTML = 'List of books';
219219
document.getElementById('container').appendChild(newDisplay);
220220

221-
fetch('http://localhost:8080/customers/getbooksinfo', {
221+
fetch('http://localhost:8000/customers/getbooksinfo', {
222222
method: 'GET',
223223
})
224224
.then(res => res.json())
@@ -254,7 +254,7 @@ window.onload = () => {
254254
deliveryDate,
255255
};
256256
order = JSON.stringify(order);
257-
fetch('http://localhost:8080/orders/createorder', {
257+
fetch('http://localhost:8000/orders/createorder', {
258258
method: 'POST',
259259
headers: { 'Content-Type': 'application/json' },
260260
body: order,
@@ -276,7 +276,7 @@ window.onload = () => {
276276
newDisplay.id = 'display';
277277
newDisplay.innerHTML = 'List of orders';
278278
document.getElementById('container').appendChild(newDisplay);
279-
fetch('http://localhost:8080/orders/getorders', {
279+
fetch('http://localhost:8000/orders/getorders', {
280280
method: 'GET',
281281
})
282282
.then(res => res.json())
@@ -297,7 +297,7 @@ window.onload = () => {
297297
const newDisplay = document.createElement('ul');
298298
newDisplay.id = 'display';
299299
document.getElementById('container').appendChild(newDisplay);
300-
const url = new URL('http://localhost:8080/orders/deleteorder:id?');
300+
const url = new URL('http://localhost:8000/orders/deleteorder:id?');
301301
url.searchParams.append('id', orderInDb._id);
302302
fetch(url, {
303303
method: 'DELETE',
@@ -323,7 +323,7 @@ window.onload = () => {
323323
newDisplay.innerHTML = 'List of customers';
324324
document.getElementById('container').appendChild(newDisplay);
325325

326-
fetch('http://localhost:8080/orders/getcustomersinfo', {
326+
fetch('http://localhost:8000/orders/getcustomersinfo', {
327327
method: 'GET',
328328
})
329329
.then(res => res.json())

examples/docker/frontend/server.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ app.use((error, req, res, next) => {
5555
});
5656

5757
// Open and listen to server on specified port
58-
app.listen(3000, () => {
59-
console.log('Frontend server running on port 3000 ...');
58+
app.listen(3333, () => {
59+
console.log('Frontend server running on port 3333 ...');
6060
});

0 commit comments

Comments
 (0)