@storecraft/database-mongodb
v1.0.6
Published
Storecraft database driver for mongodb on node / bun / deno platform
Downloads
119
Maintainers
Readme
Storecraft MongoDB driver for Node.js
Official mongodb
driver for StoreCraft
on Node.js platforms.
npm i @storecraft/database-mongodb
usage
import 'dotenv/config';
import http from "node:http";
import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/core/platform/node';
import { MongoDB } from '@storecraft/database-mongodb'
import { NodeLocalStorage } from '@storecraft/core/storage/node'
const app = new App(
{
auth_admins_emails: ['[email protected]'],
auth_secret_access_token: 'auth_secret_access_token',
auth_secret_refresh_token: 'auth_secret_refresh_token'
}
)
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB({ db_name: 'test'}))
await app.init();
const server = http.createServer(app.handler).listen(
8000,
() => {
console.log(`Server is running on http://localhost:8000`);
}
);
Author: Tomer Shalev <[email protected]>