Initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { MongoMemoryServer } from 'mongodb-memory-server';
|
||||
|
||||
const mongo = await MongoMemoryServer.create({
|
||||
instance: {
|
||||
port: 27017,
|
||||
dbName: 'lean101',
|
||||
ip: '127.0.0.1'
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`MongoDB demo server running at ${mongo.getUri()}`);
|
||||
console.log('Press Ctrl+C to stop it.');
|
||||
|
||||
const shutdown = async () => {
|
||||
await mongo.stop();
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
process.on('SIGINT', shutdown);
|
||||
process.on('SIGTERM', shutdown);
|
||||
Reference in New Issue
Block a user