You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
351 B

3 years ago
  1. import {Request, Response} from 'express';
  2. import {COURSES} from "./db-data";
  3. export function deleteCourse(req: Request, res: Response) {
  4. console.log("Deleting course ...");
  5. const id = req.params["id"];
  6. const course = COURSES[id];
  7. delete COURSES[id];
  8. setTimeout(() => {
  9. res.status(200).json({id});
  10. }, 2000);
  11. }