New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

czar

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

czar

A light weight and flexible CMS for node.js with dead simple integration.

latest
Source
npmnpm
Version
1.0.15
Version published
Maintainers
1
Created
Source

czar

A light weight and flexible CMS for node.js with dead simple integration.

Include the module, start it up within your express server and everything is handled for you.

alt tag

install

npm i -S czar

get started

Configure your server:

const express = require('express')
const path = require('path')

/* 1. Include the module. */
const CMS = require('czar')

const app = express()

/* 2. Initialise czar with your express instance. */
const cms = new CMS(app)

/* 3. Call start() with your configuration, it must be an array containing sections.
      The following example is enough to create and edit simple blog posts.
*/
cms.start([{
  name: 'blog',
  fields: [
    {type: 'text', name: 'title'},
    {type: 'textarea', name: 'body'}
  ]
}])

Visit yoursite.com/admin, create an admin login and manage your items.

Fetch the data in the front end:

$.ajax({
  method: 'POST',
  url: '/data/get/blog', /* /data/get/{page-name} */
  dataType: 'json',
  data: {
    from: 0,         /* (Optional) fetch items after an index */
    limit: 5,        /* (Optional) maximum items to fetch */
    filter: {},      /* (Optional) filter any properties */
    sort: 'created', /* (Optional) sort by a property, defaults to creation time */
    order: 'desc'    /* (Optional) order in desc or asc order, defaults to desc */
    trunc: 100       /* (Optional) truncate the fields */
  }
})
.done(function(posts) {
  /*  You have your posts! */
})

Easy!

Keywords

CMS

FAQs

Package last updated on 31 May 2016

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