eaa
express-amp-async
npm i express-amp-async
eaa

express-amp-async

Express middleware to convert website to Google AMP - ASYNC

by Mher Margaryan

1.0.2 (see all)License:MITTypeScript:Not FoundCategories:Express AMP
npm i express-amp-async
Readme

express-amp-async

⚡ Express middleware to convert website to Google AMP - ASYNC rendering. Fork from https://github.com/jlopezxs/express-amp

Installation

npm install --save express-amp-async

Preview

/**
 * Overriding the render method
 * You can use that to avoid use renderAMP
 * With that you can transform all /path in AMP pages
 */

import express from 'express';
import expressAMP from 'express-amp-async';

const app = express();

app.use(expressAMP({
  override: true,
  staticsPath: `${process.cwd()}/public`
}));

app.get('/', (req, res) => {
  res.render('index', {});
});

// Using renderAMP method

import express from 'express';
import expressAMP from 'express-amp-async';

const app = express();

app.use(expressAMP({
  override: false,
  staticsPath: `${process.cwd()}/public`
}));

app.get('/', (req, res) => {
  res.renderAMP('index', {});
});

Usage

expressAMP({ [override], [staticsPath] });

where:

  • override (optional): It brings you the possibility to override the method render or use renderAMP method.
  • staticsPath (optional): Directory path of the statics files to get it and include inline in AMP page.

License

MIT © [Mher Margaryan] This is a fork from Jordi López

Downloads/wk

17

GitHub Stars

0

LAST COMMIT

8mos ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
1.0.2
latest
8mos ago
No tutorials found
Add a tutorial