src/support/KoatonRouter.js
async function findmodel (ctx, next) {
	let pmodel = ctx.request.url.split('?')[0].split('/')[1];
	ctx.model = ctx.db[pmodel];
	ctx.state.model = ctx.state.db[pmodel];
	await next();
}
async function findmodel (ctx, next) {
	let pmodel = ctx.request.url.split('?')[0].split('/')[1];
	ctx.model = ctx.db[pmodel];
	ctx.state.model = ctx.state.db[pmodel];
	await next();
}
async function findmodel ( ctx , next ) { let pmodel = ctx . request . url . split ( '?' ) [ 0 ] . split ( '/' ) [ 1 ] ; ctx . model = ctx . db [ pmodel ] ; ctx . state . model = ctx . state . db [ pmodel ] ; await next ( ) ; }
Reads the model that is requested based on the route
and appends model to ctx.state
@param {KoaContext} ctx
@param {KoaNext} next
@param {JSURL} ctx.model - reference attached. DEPRECATED.
@param {JSURL} ctx.state.model - reference attached.
Reads the model that is requested based on the route and appends model to ctx . state