O'Reilly logo

Web Application Development with MEAN by Robert Onodi, Adrian Mejia, Amos Q. Haviv

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating an order

So far, users can add/remove products from the cart, and go to a checkout page. Now we need to implement the actual checkout functionality. Using HTTP POST, we can send all the cart information to the backend to create an order. Let's create a new API call for the orders:

yo angular-fullstack:endpoint order

? What will the url of your endpoint be? /api/orders
   create server/api/order/order.controller.js
   create server/api/order/order.events.js
   create server/api/order/order.integration.js
   create server/api/order/order.model.js
   create server/api/order/order.socket.js
   create server/api/order/index.js
   create server/api/order/index.spec.js

The preceding command will create all the scaffolding code needed to CRUD orders.

Modifying ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required