week5-node-express-knex-pg/routes/subscribers.js
Jeannette Chin 58f45f8947 first commit
2024-10-21 17:09:40 +01:00

32 lines
597 B
JavaScript

import express from "express";
import {
getSubscribers,
addSubscriber,
getSubscriber,
deleteSubscriber
} from "../controllers/subscribers.js";
const router = express.Router();
/* GET a single subscriber request */
router.get("/:id", (req, res) => {
getSubscriber(req, res);
});
/* default path GET request */
router.get("/", (req, res) => {
getSubscribers(req, res);
});
/* add a subscriber */
router.post("/add", (req, res) => {
addSubscriber(req, res);
});
/* delete a subscriber */
router.delete("/", (req, res) => {
deleteSubscriber(req, res);
});
export default router;