0.2.4 • Published 5 years ago

cms-module-server v0.2.4

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

CMS Module Server

This package complements the cms-module-client package by adding functions in the server to render and save content provided from the client package.

Installation

To install this package simply run:

npm install cms-module-server

Usage

To use this package properly you will need to connect to a MongoDB server using the mongoose package.

To call the save function with data from the client:

const cms = require("cms-module-server");
const express = require("express");
const app = express();

const PORT = process.env.PORT;

app.post("cms/save", (req, res) => {
	// There should be some kind of authentication here...

	cms.save(req, res);
});

app.listen(PORT);

To call the publish function with data from the client:

const cms = require("cms-module-server");
const express = require("express");
const app = express();

const PORT = process.env.PORT;

app.post("cms/publish", (req, res) => {
	// There should be some kind of authentication here...

	cms.publish(req, res);
});

app.listen(PORT);

To call the upload function with data from the client:

const cms = require("cms-module-server");
const express = require("express");
const app = express();

const PORT = process.env.PORT;

app.post("cms/upload", (req, res) => {
	// There should be some kind of authentication here...

	cms.upload(req, res);
});

app.listen(PORT);

To render content that is published:

const cms = require("cms-module-server");
const express = require("express");
const app = express();

const PORT = process.env.PORT;

app.use(cms.render("dist"));

// Use express.static to handle default files.
app.use(express.static("dist"));

app.listen(PORT);

Security

It is important that you authenticate users in your endpoints. The cms-module-client provides an auth option that sets an Authorization header which can be read on the server. But the help from this package ends there, you will have to solve the rest yourself.

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.2

5 years ago

0.1.2-dev.2

5 years ago

0.1.2-dev.1

5 years ago

0.1.2-dev.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago