Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grasshopper-cms

Package Overview
Dependencies
Maintainers
5
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grasshopper-cms

Requires Node 6+.

  • 0.27.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

Grasshopper-CMS

Requires Node 6+.

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

Docs at http://docs.grasshopper.ws . 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.

FAQs

Package last updated on 01 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc