I'm building a penny-auction platform like DealDash and just read into the WebSocket and node.js topic. I used PHP, MySQL and Ajax to build the website. I'm nearly finished and just have to implement the WebSocket function for the auctions to display correctly for all users.
I found a script to help me getting started with node.js and mysql, so I can still retrieve the data from my database every second. Because I need the auction timer and price to be displayed asynchronously for all users. Because I also have to complete this project in some days. But I'm considering learning more about NoSQL-db's and node.js, etc. afterwards of course.
However I've managed to have all auction items updated on the starting page async. with multiple browsers. So changes are updated for every user like I wanted it to be.
Now every auction has a single page to get further details to an auction and to the product. And usually I used $_GET['id']
in PHP/MySQL to receive the needed data which specific auction this is. But the node.js server-file server.js
is the file to SELECT * FROM db
.
So here's my problem. Do I have to tell the server-file, if the user is on an specific auction-id-page it has to make another specific query? I can't image that, because other projects like a social network would've dozens of specific queries, all written in the node.js server-file? Also using an if-else statement in the server-file doesn't seem right? Also I don't know how I would get this specific id of an auction.
I'm just confused about the right way to realize something like that, because I'm so used to PHP/MySQL/Ajax and hope you could help me with that.