Skip to content

Commit

Permalink
fix: return cors header
Browse files Browse the repository at this point in the history
  • Loading branch information
phramos07 committed Mar 17, 2022
1 parent 4905600 commit d560509
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node

COPY . /app

WORKDIR /app

RUN npm install

ENV PORT=80

EXPOSE 80

CMD ["npm", "start"]
6 changes: 5 additions & 1 deletion src/api/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ const errorMiddleware = require('../middlewares/error');

const app = express();

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

app.get('/users', rescue(UserController));
app.use(errorMiddleware);

module.exports = app;

0 comments on commit d560509

Please sign in to comment.