I'm working through a tutorial on how to create a restful api using express and mongoose.
I'm understanding everything except for this bit right here
import mongoose from 'mongoose';
import config from './config';
export default callback => {
// connect to the database
let db = mongoose.connect(config.mongoUrl);
// callback db
callback(db);
}
I understand what its purpose is and how to call it. What's confusing me is the callback(db) part.
Is that a built in function or is it somehow calling itself?
via Tucker Beauchamp
No comments:
Post a Comment