Any suggenstion how to implement shopping cart feature?
How can I implement a shopping cart feature in my food delibery application, utilizing Vue.js for the frontend and .NET Web API for the backend, allowing authenticated users to add products to their carts?
2 Replies
im assumming you asking for a flow?
imo.
More or less like this?
I dunno about frontend, but for backend:
0) use CORS Middleware
1) create user. You can use Identity Framework. It is ready solution with many features such as roles, claims. Add a JWT token for Auth
2) create entities to store: sale (one to many with user), cart (one to one with user), product (one to many with sale)
3) install mapper and create some configs or do it manually
4) if you are not using EF Core: create some repositories to easily manage db operations (CRUD)
5) create some services to manage domain logic
5) not necessary step: install mediatr and follow CQRS principles 6) create some filters on you endpoints This is only what I can recommend for now. It can be more additional steps which depends on your domain layer
5) not necessary step: install mediatr and follow CQRS principles 6) create some filters on you endpoints This is only what I can recommend for now. It can be more additional steps which depends on your domain layer