1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/examples/with-cookie-auth/api/index.js
Juan Olvera 80cb91ec87 Add setup to run example with cookie authentication locally (#6101)
* extract request login from auth

* add clarification that the monorepo is for deploy in Now only and fix typo

* Refactor HOC

- add authorization to HOC
- add displayName to HOC
- remove unnecessary `run`s in local routing
2019-02-11 14:17:43 +01:00

21 lines
390 B
JavaScript

const { send } = require('micro')
const login = require('./login')
const profile = require('./profile')
const dev = async (req, res) => {
switch (req.url) {
case '/api/profile.js':
await profile(req, res)
break
case '/api/login.js':
await login(req, res)
break
default:
send(res, 404, '404. Not found.')
break
}
}
module.exports = dev