Put in order · Vibe coding with Claude Code course · Module 12: Medium clone

The order in the publication route

Put the lines of the publication route in order from reading the parameters to saving:

Items to put in order

  • publishArticle(id);
  • const { id } = await params;
  • if (!canPublish(role)) return Response.json({ error }, { status: 403 });
  • const role = roleIn(article.publication, await getCurrentUserId());
  • const article = getArticle(id); // 404 when it does not exist

You can check the correct answer by solving this task in the CodeWorlds game.