Skip to content

Express.js integration

Frames.js can be easily integrated to Express.js server.

Usage

/* eslint-disable react/jsx-key */
import express from "express";
import { createFrames, Button } from "frames.js/express";
 
const app = express();
const frames = createFrames();
const handleRequest = frames(async (ctx) => {
  return {
    image: <span>My image</span>,
    buttons: [<Button action="post">Click me</Button>],
  };
});
 
app.get("/", handleRequest);
app.post("/", handleRequest);