cnpmjs.org
Version:
Private npm registry and web for Enterprise, base on MySQL and Simple Store Service
33 lines (27 loc) • 525 B
JavaScript
/**!
* cnpmjs.org - middleware/registry_not_found.js
*
* Copyright(c) cnpmjs.org and other contributors.
* MIT Licensed
*
* Authors:
* dead_horse <dead_horse@qq.com> (http://deadhorse.me)
*/
;
/**
* Module dependencies.
*/
module.exports = function* notFound(next) {
yield* next;
if (this.status && this.status !== 404) {
return;
}
if (this.body && this.body.name) {
return;
}
this.status = 404;
this.body = {
error: 'not_found',
reason: 'document not found'
};
};