Postman
Generate postman collections automatically!
# Execute the built-in Deno task
deno task sync:postmanArgument/Alias
Purpose
Postman Metadata
import {
Controller,
BaseController,
Get,
Post,
Response,
type IRoute,
type IRequestContext,
} from "@Core/common/mod.ts";
import { Status, type RouterContext } from "oak";
import e from "validator";
@Controller("/users/", { name: "users" })
export default class UsersController extends BaseController {
@Post("/")
public create(_: IRoute) {
// Usually, you may write the validation schema as follows to validate the incoming request inputs
// Define Query Schema
const QuerySchema = e.object({}, { allowUnexpectedProps: true });
// Define Params Schema
const ParamsSchema = e.object({});
// Define Body Schema
const BodySchema = e.object({});
// Define Response Schema
const ResponseSchema = e.object({});
return {
// This is where you pass the input and output shapes so that the Epic framework can build a Postman collection.
shape: () => ({
query: QuerySchema.toSample(),
params: ParamsSchema.toSample(),
body: BodySchema.toSample(),
return: ResponseSchema.toSample(),
}),
handler: async (ctx: IRequestContext<RouterContext<string>>) => {
// Start coding here...
return Response.statusCode(Status.Created);
},
};
}
}
Last updated