Express-style router for Fastly's Compute@Edge.
First, head over to developer.fastly.com to get started with JavaScript on Fastly's Compute@Edge:
- Learn about Compute@Edge: developer.fastly.com/learning/compute/
- Create your first JavaScript app: developer.fastly.com/learning/compute/javascript/
Install expressly from the npm registry:
npm i @fastly/expressly
yarn add @fastly/expressly
Replace the contents of your Compute@Edge app's src/index.js
with the following:
import { Router } from "@fastly/expressly";
const router = new Router();
router.get("/", async (req, res) => {
return res.send("Hello world!");
});
router.listen();
Start your app locally:
fastly compute serve
This will start your service on http://localhost:7676.
Check out the JavaScript code examples for Compute@Edge on Fastly's Developer Hub.