0.0.9 • Published 6 years ago
@arena-im/arena-express-middleware v0.0.9
Arena Express Middleware
Features
SEO Middleware
Adds the appropriate SEO JSON-LD data into HTML according to the arena events embedded in the page.
Installation
Install using npm.
$ npm install @arena-im/arena-express-middlewareUsage
Then use it in your Node.js script like this example:
const express = require('express');
const arenaExpressMiddleware = require('@arena-im/arena-express-middleware');
const app = express();
app.use("posts/*", (req, res, next) => {
res.locals.static = __dirname + "/public/index.html";
next();
});
app.use("posts/*", arenaExpressMiddleware);
app.listen(8000);This sample demonstrates the most simplistic usage of Arena Express Middleware. It simply creates a new Express Application and in the example route posts/* it set on locals.staticthe HTML file path used to render the page. Then it calls the next()function to call the next middleware that uses the Arena Express Middleware to inject its features in the HTML.