- Convert MDX CodeBlock components to standard markdown code fences - Add rehype-mdx-code-props to pass filename meta to code components - Custom pre/code MDX components map fences to CodeBlock - Add brand color badges (product + category) matching /learn layout - Match prose styling: orange inline code, orange links, white strong - Remove brand color background glow (not in /learn)
66 lines
1.4 KiB
Plaintext
66 lines
1.4 KiB
Plaintext
---
|
|
title: "Express"
|
|
description: "Serve Pulse analytics from your Express.js app. Middleware or template-based setup."
|
|
category: "backend"
|
|
brandColor: "#000000"
|
|
officialUrl: "https://expressjs.com"
|
|
relatedIds: ["flask", "nextjs", "react"]
|
|
date: "2026-03-28"
|
|
---
|
|
|
|
Add the Pulse script to your template engine's layout (EJS, Pug, Handlebars) or serve it via static HTML.
|
|
|
|
---
|
|
|
|
## Method 1: EJS template
|
|
|
|
If you use EJS as your template engine, add the script to your layout with a production guard.
|
|
|
|
```html filename="views/layout.ejs"
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<% if (process.env.NODE_ENV === 'production') { %>
|
|
<script
|
|
defer
|
|
data-domain="your-site.com"
|
|
src="https://pulse.ciphera.net/script.js"
|
|
></script>
|
|
<% } %>
|
|
|
|
<title><%= title %></title>
|
|
</head>
|
|
<body>
|
|
<%- body %>
|
|
</body>
|
|
</html>
|
|
```
|
|
|
|
## Method 2: Static HTML
|
|
|
|
If you serve static HTML files via Express, add the script directly.
|
|
|
|
```html filename="public/index.html"
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<script
|
|
defer
|
|
data-domain="your-site.com"
|
|
src="https://pulse.ciphera.net/script.js"
|
|
></script>
|
|
|
|
<title>My Express App</title>
|
|
</head>
|
|
<body>
|
|
<h1>Hello World</h1>
|
|
</body>
|
|
</html>
|
|
```
|