Skip to content

Commit 97df1cf

Browse files
committed
feat: configurado para entrar na porta 49160:1337 e criar imagem
1 parent ce6b3d4 commit 97df1cf

File tree

5 files changed

+40
-2
lines changed

5 files changed

+40
-2
lines changed

.Dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
npm-debug.log

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM node:current-slim
2+
3+
RUN apt-get update -y && apt-get upgrade -y
4+
5+
6+
WORKDIR /SIMPLE-NODE-API
7+
8+
COPY ./package.json ./package.json
9+
RUN npm install
10+
11+
COPY ./routes.js routes.js
12+
COPY ./server.js server.js
13+
COPY ./todos.js todos.js
14+
15+
EXPOSE 1337
16+
ENTRYPOINT [ "node", "server" ]

example-ingress.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: example-ingress
5+
annotations:
6+
nginx.ingress.kubernetes.io/rewrite-target: /$1
7+
spec:
8+
rules:
9+
- host: teste
10+
http:
11+
paths:
12+
- path: /
13+
pathType: Prefix
14+
backend:
15+
service:
16+
name: teste
17+
port:
18+
number: 1337

routes.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const todos = require("./todos");
33

44
const router = express.Router();
55

6-
router.get("/todos", function(req, res) {
6+
router.use( function(req, res) {
7+
req.url
8+
console.log(req.url);
79
res.json(todos);
810
});
911

server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const routes = require("./routes");
55
const app = express();
66

77
// Set port
8-
const port = process.env.PORT || "1337";
8+
const port = "1337";
99
app.set("port", port);
1010

1111
app.use('/', routes);

0 commit comments

Comments
 (0)