Giter Site home page Giter Site logo

Grasshopper-CMS

Requires Node 6+.

Demo Project at https://github.com/grasshopper-cms/grasshopper-demo .

Docs at http://grasshopper-docs.soliddigital.com . The below is an excerpt from the docs:

Quick Start

This is how to get started using Grasshopper.

Grasshopper is a headless CMS with an admin. It can be used to build both apis and websites.

To get started require grasshopper-cms and init with your config object:

const express = require('express');
const app = express();
const grasshopper = require('grasshopper-cms');


grasshopper
    .start({
        app,
        express,
        // Other configs here
    })
    .then(() => {
        
        // grasshopper.authenticatedRequest is now available
        // grasshopper.grasshopper is now available
        
        console.log('listening on port 3000');
        app.listen(3000);
    })
    .catch(err => {
        console.log('startup error', err);
    })

For an example config object see the grasshopper-demo.

In the example above, app is a standard express app. You can set it up as you normally would for a website or api. You can inform your models with queries via grasshopper.authenticatedRequest, the grasshopper api is running at /api, and you can view the admin at https://localhost:3000/admin .

Queries

Queries are promise based. Query content involves looking for content by _id, by querying for fields on the document, or query for meta data on the document.

A Grasshopper content item has this form:

{
    _id
    fields : {
        
    },
    meta : {
       type,
       node,
       labelfield,
       typelabel,
       created,
       lastmodified
    }
}

The keys for meta are stable. The keys for fields are defined in the admin by modifying the content type.

So querying all

return ghService
    .authenticatedRequest.content.query({
        filters : [
            {
                key : 'fields.title',
                cmp : '=',
                value : 'My Post'
            },
            {
                key : 'meta.typelabel',
                cmp : '=',
                value : 'Standard Post'
            }
        ],
        nodes: [
            // The id of the node
            '58943396364f3b528af81f80'
        ],
        options : {
            sort: {
                'fields.title' : 1
            }
        }
    })

Note: Update the Release Notes when publishing new versions.

grasshopper-cms's Projects

grasshopper-api-js icon grasshopper-api-js

HTTP wrapper for grasshopper-core. Grasshopper is a Data Management System (DMS) that makes working with application data easier for both administrators and developers.

grasshopper-core-nodejs icon grasshopper-core-nodejs

Grasshopper is a Data Management System (DMS) that makes working with application data easier for both administrators and developers.

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.