Files
lean-101-website/scripts/mongo-demo.mjs
T

21 lines
438 B
JavaScript
Raw Normal View History

2026-05-06 22:38:06 +12:00
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);