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.

24 lines
395 B

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