Skip to content

Instantly share code, notes, and snippets.

@dgieselaar
Last active September 9, 2019 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgieselaar/f2a304b4284d33f9731a2c2a2f89c3c1 to your computer and use it in GitHub Desktop.
Save dgieselaar/f2a304b4284d33f9731a2c2a2f89c3c1 to your computer and use it in GitHub Desktop.
const route = createRoute({
url: '/api/metrics/:type',
method: 'GET',
params: {
path: t.type({
type: t.string
}),
query: t.type({
start: t.string,
end: t.string
})
},
handler: ( request ) => {
const { type } = request.params;
const { start, end } = request.query;
return getMetrics({ type, start, end });
}
});
server.route(route);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment