-
-
Save bendrucker/9123492 to your computer and use it in GitHub Desktop.
Initializing databases with Bookshelf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i = 0; | |
module.exports = ++i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('./a'); // 1 | |
require('./a'); // 1 | |
require('./a'); // 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Bookshelf = require('bookshelf'); | |
module.exports = Bookshelf.initialize({ | |
client: 'pg', | |
connection: { | |
host: 'localhost', | |
user: 'Ben', | |
database: 'valet_io_auction' | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a.js
andb.js
are an illustration of how module caching works in Node. Once a particular module has been required, its value will be cached for any future requires in the same context, including from other files.