英文:
var debug = require('debug')('express-locallibrary-tutorial:server'); I'd like to know mean of it. I'd like to know mean of it
问题
I'm learning Express for backend development.
So I built express-locallibrary-tutorial from GitHub.
But I don't understand
var debug = require('debug')('express-locallibrary-tutorial:server');
So I hope someone will expand me in detail about it.
I found "debug": "~2.6.9" as dependency in package.json.
So I understood
var debug = require('debug')
as dependency.
But I can't understand
var debug = require('debug')('express-locallibrary-tutorial:server')
英文:
I'm learning Express for backend development.
So I built express-locallibrary-tutorial from GitHub.
But I don't understand
var debug = require('debug')('express-locallibrary-tutorial:server');
So I hope someone will expand me in detail about it.
I found "debug": "~2.6.9" as dependency in package.json.
So I understood
var debug = require('debug')
as dependency.
But I can't understand
var debug = require('debug')('express-locallibrary-tutorial:server')
答案1
得分: 0
require('debug')
返回一个函数。这是调用该函数并将 debug
设置为它返回的值。等效于:
var debug_func = require('debug');
var debug = debug_func('express-locallibrary-tutorial:server');
英文:
require('debug')
returns a function. This is calling that function and setting debug
to the value it returns. It's equivalent to:
var debug_func = require('debug');
var debug = debug_func('express-locallibrary-tutorial:server');
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论