api-model-mongoose

Data Model factory for api-core based APIs using MongoDB as a data source.

Usage no npm install needed!

<script type="module">
  import apiModelMongoose from 'https://cdn.skypack.dev/api-model-mongoose';
</script>

README

api-model-mongoose

Data Model factory for api-core based APIs using MongoDB as a data source.

Installation

npm install api-model-mongoose

Usage

const mongoose = require('mongoose'),
      MongooseModelFactory = require('api-model-mongoose').MongooseModelFactory;

const UserEdge =
    MongooseModelFactory.createModel("user", "users", {
        id: String,
        firstName: String,
        lastName: String,
        email: String,
        phone: String
    });
    
const API = new Api('1.0').edge(new UserEdge());