Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Router
import { Router } from "express";
import { Config } from "./configuration";
// Import or require the graphite controller and activity labels
import { GraphiteController, GraphiteLabel } from "../graphite";
const router = Router() as Router;
// Load your config
const config = Config.getConfig();
// Import the graphite controller
const graphiteController = GraphiteController.getInstance(config);
router.get("/", async (req, res, next) => {
try {
const record = await UserController.get(req.query, req.jwt.accountId);
if (record) {
// Just before the response is sent, we log the route being called
graphiteController.write(“GetUsers”);
res.json({ success: true, data: record });
} else {
res.status(404).send();
}
} catch (err) {
next(new InternalServerError("There was an error getting data from the database"));
}
});
export default router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.