Skip to content

Commit

Permalink
fixes #9 cors related issue with the front end and the mock server
Browse files Browse the repository at this point in the history
  • Loading branch information
NorikDavtian committed Jan 12, 2018
1 parent 6880b12 commit baf1f65
Show file tree
Hide file tree
Showing 3 changed files with 374 additions and 218 deletions.
5 changes: 3 additions & 2 deletions mock_server/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const micro = require('micro');

const { send } = micro;
const cors = require('micro-cors')();
const { router, get } = require('microrouter');
const api = require('./api/');

Expand All @@ -13,9 +14,9 @@ const email = async (req, res) =>
const notFound = async (req, res) =>
send(res, 404, await api.notFound);

module.exports = router(
module.exports = cors(router(
get('/api/inbox', inbox),
get('/api/email/:id', email),
get('/*', notFound)
);
));

Loading

0 comments on commit baf1f65

Please sign in to comment.