INNER CODE UNIT · JavaScript

handler

urdadx/librelinks · pages/api/links/index.js:4

export default async function handler(req, res) {
  if (req.method !== 'POST' && req.method !== 'GET' && req.method !== 'PUT') {
    return res.status(405).end();
  }

  try {
    if (req.method === 'POST') {
      const { currentUser } = await serverAuth(req, res);
      const { title, url, order, isSocial } = req.body;

      const link = await db.link.create({
        data: {
          title,
          url,
          order,
          userId: currentUser.id,
          isSocial,
        },

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…