import cors from 'micro-cors'; import { server } from './server'; import { config } from './config'; // connect to Database // connect( // `${config.database.url}/${config.database.tableName}?retryWrites=true&w=majority`, // { // useNewUrlParser: true, // useFindAndModify: false, // useCreateIndex: true, // useUnifiedTopology: true, // } // ).catch(reason => { // // TODO: determine the best repsonse to this // console.error("couldn't connect to database"); // console.error(reason); // }); // start up server module.exports = cors()((req, res) => { if (req.method === 'OPTIONS') { res.end(); return; } return server.createHandler({ path: '/' })(req, res); });