mirror of
https://github.com/elicpeter/nyx.git
synced 2026-07-03 20:41:00 +02:00
20 lines
553 B
JavaScript
20 lines
553 B
JavaScript
const fastify = require("fastify")();
|
|||
const requireAuth = require("./auth").requireAuth;
|
|||
|
|||
fastify.addHook("preHandler", requireAuth);
|
|||
fastify.register(async function projectPlugin(instance) {
|
|||
instance.decorate("requireWorkspace", requireAuth);
|
|||
});
|
|||
|
|||
fastify.route({
|
|||
method: "GET",
|
|||
url: "/me/projects",
|
|||
preHandler: requireAuth,
|
|||
handler: async function listProjects(request, reply) {
|
|||
const projects = await projectService.listForUser(request.user.id);
|
|||
reply.send({ projects });
|
|||
},
|
|||
});
|
|||
|
|||
module.exports = { fastify };
|