because there is too much startup file code, I want to write the routing code into the module folder.
but why does viewing the log return undefined,?
router.js file:
//router
const koa_router = require("koa-router");
//
const router = new koa_router();
module.exports.get= function() {
router.get("/", (ctx, next) => {
ctx.render("index");
});
};
Startup file server.js: (other files are loaded differently, extract this part of the code)
//
k_router = require("Router"),
//Koa
app = new Koa(),
//
router = new koa_router();
//
k_router.get();
console.log(k_router.get()); //undefined
is the module file written correctly?