Skip to content

Commit d560509

Browse files
committed
fix: return cors header
1 parent 4905600 commit d560509

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM node
2+
3+
COPY . /app
4+
5+
WORKDIR /app
6+
7+
RUN npm install
8+
9+
ENV PORT=80
10+
11+
EXPOSE 80
12+
13+
CMD ["npm", "start"]

src/api/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ const errorMiddleware = require('../middlewares/error');
55

66
const app = express();
77

8-
app.get('/users', rescue(UserController));
8+
app.use((req, res, next) => {
9+
res.setHeader('Access-Control-Allow-Origin', '*');
10+
next();
11+
})
912

13+
app.get('/users', rescue(UserController));
1014
app.use(errorMiddleware);
1115

1216
module.exports = app;

0 commit comments

Comments
 (0)