realm
Realm is a service provided by MongoDB Atlas to interact with your database over HTTP instead of a traditional TCP connection, which basically means you can use MongoDB from Cloudflare Workers. This module makes it really easy to use Realm in darkflare without having to set up a database connection in each route.
Please read their documentation to learn more.
Note: You need to have
realm_app
,realm_database
, andrealm_token
set as environment variables in order to use this module.
Schema
import { Schema, ObjectId } from 'darkflare/realm'
const userSchema = new Schema<{
_id: ObjectId
name: string
email: string
password: string
}>('users') // collection name
export default userSchema