32 lines
597 B
JavaScript
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;
|