Code Monkey home page Code Monkey logo

dbh's Introduction

what is it?

DBH is a powerfull library for creating methods to work with MongoDB

I am using it myself in API for my site. It is very fast and simple to understand.

If you don't like to check every param from http requests, DBH has good instruments to check your params values and types. It will't able you to make mistake and save wrong data.

Also you can write your own errors names if you don't like DBH default error names

It using config params and creating methods from templates

install

  npm i hm-dbh

initing module

  const DB = {
    login: "",    // MongoDB User login
    password: "", // MongoDB user password
    host: "",     // url to MongoDB server
    database: ""  // MongoDB database name
  }

  const options = {
    // edit default DBH config values
  }

  const GEN = require("path to GEN file")

  DBH.init(DB, options, GEN).then(() => {
    // do something
  })

example usage

// req.body.auth - jwt token
DBH.User.postJWT(req.body.auth).then(user => {
  DBH.User.login(user).then(User => {
      User.name = "John"
      User.surname = "Doe"
      User.save()
      // ...

GEN template guide:

see ./example/gen.example.js

dbh's People

Contributors

happy-mama avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.