@vercel/routing-utils

Vercel routing utilities

Usage no npm install needed!

<script type="module">
  import vercelRoutingUtils from 'https://cdn.skypack.dev/@vercel/routing-utils';
</script>

README

@vercel/routing-utils

Route validation utilities

Usage

yarn add @vercel/routing-utils

import { normalizeRoutes } from '@vercel/routing-utils';

const { routes, error } = normalizeRoutes(inputRoutes);

if (error) {
  console.log(error.code, error.message);
}
import { routesSchema } from '@vercel/routing-utils';

const ajv = new Ajv();
const validate = ajv.compile(routesSchema);
const valid = validate([{ src: '/about', dest: '/about.html' }]);

if (!valid) console.log(validate.errors);