Skip to content

Bloggify/bloggify-mongoose

Repository files navigation

bloggify-mongoose

Version Downloads

Support for Mongoose models in Bloggify.

☁️ Installation

# Using npm
npm install --save bloggify-mongoose

# Using yarn
yarn add bloggify-mongoose

📋 Example

// Configuration example
module.exports = {
    db: "mongodb://localhost/people"
  , models_dir: "path/to/models"
    /*
        Comment.js:
            module.exports = {
                body: String,
                ...
            };
     */
  , models: {
        User: {
            name: {
                first: {
                    type: String
                  , required: true
                  , match: [/.*\S+.*/, "Invalid name."]
                }
              , last: {
                    type: String
                  , required: true
                  , match: [/.*\S+.*/, "Invalid name."]
                }
            }
          , email: {
                type: String
              , index: true
              , required: true
              , match: [/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/, "Please fill a valid email address."]
            }
        }
    }
};

❓ Get Help

There are few ways to get help:

  1. Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
  2. For bug reports and feature requests, open issues. 🐛

📝 Documentation

Plugin Configuration

  • Object config:
  • uri (String): The database url.
  • models (Object): An object containing the Mongoose models.
  • models_dir (String): The relative path to a directory containing models stored in files.

The model objects can be accessed by requiring the module or accessing the Bloggify.models object.

😋 How to contribute

Have an idea? Found a bug? See how to contribute.

💫 Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

  • todos-app-bloggify-react

📜 License

MIT © Bloggify