0.1.27 • Published 7 years ago
express-mesh v0.1.27
express-mesh
An extension for express to serve content from Gentics Mesh.
To get/download Gentics Mesh, check out http://getmesh.io/.
Features
- Serve websites powerded by Gentics Mesh
- Swig template engine
- Custom template filters
- Custom schema, error and view handlers
- Usable with pure JavaScript and TypeScript
- Completely typed API with TypeScript
How to install
1. Install express-mesh
npm install -save express-mesh
Basic Usage
Below is a minimal express app will serve content from a local mesh installation.
var express = require('express');
var http = require('http');
var path = require('path');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var swig = require('swig');
var expressCompression = require('compression');
var cons = require('consolidate');
var mesh = require('express-mesh');
var port = process.env.PORT || 8089,
app = express(),
server = http.createServer(app),
viewDir = __dirname + '/views',
Mesh = new mesh.Mesh(app,mesh.MeshConfig.createSimpleConfiguration('demo'));
app.set('views', viewDir);
app.engine('html', cons.swig);
app.set('view engine', 'html');
app.use(expressCompression());
app.use(cookieParser());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(session({
secret: 'mysupersecuresessionsecret',
resave: false,
saveUninitialized: false
}));
// serving of static resources
app.use(express.static(path.join(__dirname, 'public')));
// if we want to have the mesh template filters, we need to register them
Mesh.registerTemplateFilters(swig);
// initialize the mesh frontend
Mesh.server(app);
server.listen(port, () => {
console.log("Express server listening on port " + port);
});
0.1.27
7 years ago
0.1.26
8 years ago
0.4.0
8 years ago
0.3.0
8 years ago
0.2.0
8 years ago
0.1.25
8 years ago
0.1.24
9 years ago
0.1.23
9 years ago
0.1.22
9 years ago
0.1.21
9 years ago
0.1.20
9 years ago
0.1.19
9 years ago
0.1.18
9 years ago
0.1.17
9 years ago
0.1.16
9 years ago
0.1.15
9 years ago
0.1.14
10 years ago
0.1.13
10 years ago
0.1.12
10 years ago
0.1.11
10 years ago
0.1.10
10 years ago
0.1.9
10 years ago
0.1.8
10 years ago
0.1.7
10 years ago
0.1.6
10 years ago
0.1.5
10 years ago
0.1.4
10 years ago
0.1.3
10 years ago
0.1.2
10 years ago
0.1.1
10 years ago
0.1.0
10 years ago