Quick start
To install and setup Quality API, simply run the following command in your command line:
npm install @quality-api/coreYour first endpoint
Quality API follows the builder pattern. This makes adding middleware easy, and makes the code easier to structure.
A simple endpoint, with a middleware, would look something like this:
import QualityApi from "@quality-api/core";
import authenticate from "@/middleware/authenticate";
export const GET =
QualityApi.start()
.add(authenticate)
.end(request => {
return Response.json({ message: "The quick brown fox" });
});
The middleware is, naturally, added in chronological order, meaning added first means executed first.