
NullSound
Real-Time Phoenix: Cart Add not Working (page 178)
I’ve been working through the book, and I’ve gotten up to the point where I need to test adding items to my cart. However, when I click on any of the size buttons, it takes me to an error page where it says “no route found for POST /cart/add (Sneakers23Web.Router)”.
I checked the router.ex file under sneakers_23_web and there’s no entry for the /cart/add path, and there isn’t a CartController.ex file at all either so I’m not sure where to go from here.
First Post!

sb8244
Hi, thanks for reading Real-Time Phoenix. Sorry you ran into this issue.
The cart add function is handled via JavaScript at this code. This is added to the project on page 176.
If you added this JavaScript and you’re not seeing it take effect in the UI, you may need to check that the JS watcher was able to build your project, and then refresh.
Popular Prag Prog topics










Other popular topics









Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /zig
- /html
- /scala
- /debian
- /nixos
- /lisp
- /agda
- /react-native
- /sublime-text
- /textmate
- /kubuntu
- /arch-linux
- /ubuntu
- /revery
- /manjaro
- /spring
- /django
- /diversity
- /lua
- /nodejs
- /julia
- /slackware
- /c
- /neovim