just-the-cors
Tiny middleware to add cors support when using zeit's micro
Install
$ npm i just-the-cors
Example
const send = ;const router get = ;const cors = ; const getWithCors = ; const hello = ;const hello2 = { ; return ;};const hello3 = ; moduleexports = ;
Note
If you don't supply the
res
object as a second argument,cors
does nothing!
const router get = ;const cors = ; const hello1 = { ; // Does nothing! return "Hello 1";}; const hello2 = { ; return "Hello 2";}; moduleexports = ;