0.0.1-beta • Published 3 years ago

@cloudnativegbb/cosmos-odm v0.0.1-beta

Weekly downloads
2
License
ISC
Repository
github
Last release
3 years ago

Cosmos DB SQL/Core API ODM

This project is meant to be a simple ODM library for Cosmos DB via the SQL/"Core" API.

Dependencies

How to use:

npm install --save raykao/cosmos-orm
// models/user-model.js

const Model = require('cosmos-odm');
const settings = {name: "Users"};
const User = new Model(settings);

module.exports = User;
// controllers/users-controller.js
const User = require('../models/user-model');

const index = async function(req, res, next) {
  try {
    const users = await User.findAll();

    res.send({
      users: users
    })
  }
  catch(e){
    next(e);
  }
}