Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const express = require("express");
  2. const Warehouse = require("../models/warehouse");
  3. const router = express.Router();
  4.  
  5. router
  6.   .route("/")
  7.   .post((req, res) => {
  8.     new Warehouse({
  9.       name: req.body.name,
  10.       position: req.body.position,
  11.       manager: req.body.manager,
  12.       address: req.body.address,
  13.       phone: req.body.phone,
  14.       email: req.body.email,
  15.       categories: JSON.stringify(req.body.categories)
  16.     })
  17.       .save()
  18.       .then(newWarehouse => {
  19.         res.status(201).json({ newWarehouse });
  20.       });
  21.   });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement