Express.js
Repository: https://github.com/flayyer/integration-examples/tree/main/examples/express
The JavaScript module @flayyer/flayyer is the only dependency you will need. In this guide we are going to show how it can be integrated with Express.js. This guide is only a basic example and you should adapt it to your needs.
#
SetupWe assume you already have a project. If not, you can create a new one with:
- Yarn
- NPM
Then add Flayyer on your routers, controllers and handlers. Example:
routes/index.js
#
Template enginesUse your favorite view engine, just make sure to render these three metatags:
#
JadeOn your layout views:
views/layout.jade
caution
Rendering <meta />
inside the <body />
of your pages will no have the desired effect.
Make sure you always render Flayyer URLs in the <head />
of your pages.