<commit_before>const micro = require('micro')
const {MongoClient} = require('mongodb')
const {
 rpc,
 method
} = require('@hharnisc/micro-rpc')

const connectDBMiddleware = async (uri, next) => {
  const db = await MongoClient.connect(uri)
  return (req, res) => {
    req.db = db.collection('users')
    return next(req, res)
  }
}

const main = async () => {
  const handler = await connectDBMiddleware(
    process.env.MONGO_DB,
    rpc(
      method('create', () => 'create'),
      method('get', (_, {db}) => db.find().toArray()),
      method('update', () => 'update'),<commit_msg>stub in create handler<commit_after>const micro = require('micro')
const {MongoClient} = require('mongodb')
const {
 rpc,
 method,
 createError
} = require('@hharnisc/micro-rpc')

const create = async ({
  email
}, {
  db
}) => {
  if (!email) {
    throw createError({message: 'Missing Input Parameter'})
  }
  const result = await db.insertOne({
    email,
    verified: false
  })
  return {
    id: result.insertedId
  }
}

const connectDBMiddleware = async (uri, next) => {
  const db = await MongoClient.connect(uri)
  return (req, res) => {
    req.db = db.collection('users')
    return next(req, res)
  }
}

const main = async () => {
  const handler = await connectDBMiddleware(
    process.env.MONGO_DB,
    rpc(
      method('create', create),
      method('get', (_, {db}) => db.find().toArray()),
      method('update', () => 'update'),
{'fraction_non_alphanumeric': 0.17466945024356298, 'fraction_numerical': 0.0, 'mean_word_length': 3.5078369905956115, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4052932', 'n_tokens_mistral': 482, 'n_tokens_neox': 479, 'n_words': 111}