let Router = require('koa-router')

let indexCtrl = require('../controllers/indexCtrl')
let linksCtrl = require('../controllers/linksCtrl')

let AuthController = require('../controllers/authCtrl')

const router = Router({
  prefix: '/api'
})

router.get('/', indexCtrl)

router.get('/getNiceLinks', linksCtrl.getNiceLinks)

router.post('/addNiceLinks', linksCtrl.addNiceLinks)

router.post('/dispatchAction', linksCtrl.dispatchAction)

router.get('/getMyPublish', linksCtrl.getMyPublish)

// *********************Login Auth Register********************** Strat//
const authRoutes = Router()

// Registration route
authRoutes.post('/signup', AuthController.register)

// Login router
authRoutes.post('/login', AuthController.login)

// logout router
authRoutes.post('/logout', AuthController.logout)

// logoff router
authRoutes.post('/logoff', AuthController.logoff)

authRoutes.post('/active', AuthController.active)

authRoutes.post('/requestResetPwd', AuthController.requestResetPwd)

authRoutes.post('/setProfile', AuthController.setProfile)

authRoutes.get('/getProfile', AuthController.getProfile)

router.use('/auth', authRoutes.routes())
// *********************Login Auth Register********************** Strat//

module.exports = router

@@ -215,16 +215,18 @@
 outer(%7B%0A
+  
   prefix
@@ -1145,81 +1145,439 @@
 ())%0A
+%0A
 // 
-*********************Login Auth Register********************** Strat//
+api cors%0Arouter.use(async(ctx, next) =%3E %7B%0A    ctx.set('Access-Control-Allow-Credentials', 'true')%0A    ctx.set('Access-Control-Allow-Origin', ctx.get('origin') %7C%7C '*')%0A    await next()%0A%7D)%0A%0A// api options method%0Arouter.options('*', async(ctx, next) =%3E %7B%0A    ctx.set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')%0A    ctx.set('Access-Control-Allow-Origin', ctx.get('origin') %7C%7C '*')%0A    ctx.status = 204%0A    await next()%0A%7D)
 %0A%0Amo
@@ -1593,13 +1593,12 @@
 rts = router
-%0A

add cors for interface 😊