| Ok the way I do it with Angular and Vue clients (and Go servers) is: GET /api/vn/singular_name/ = list all GET /api/vn/singular_name/?field=value = list all filter by query, if it gets more complex base64 encode the query and decode on server GET /api/vn/singular_name/:id = get by id POST /api/vn/singular_name/ = create PUT /api/vn/singular_name/:id = replace PATCH /api/vn/singular_name/:id = atomic update DELETE /api/vn/singular_name/:id = duh If models are related they receive a related_model_id field.
This works even for "many to many". In the case of Vue there's this excellent library called vuex-orm, which handles normalization of incoming data and ways to define relationships or all kinds and also queries with or without related models.
It's so good that I'm abandoning Angular because it doesn't have something so sophisticated, despite it having the better component system and structure all together. Not having to subscribe and unsubscribe to data streams and deal with this torture instrument rxjs is a bonus.
Because of vuex-orm I'm more productive than I've ever been with Angular. This is sufficient and there is no need for GraphQL. Real time updates are simple.
Whenever something like INSERT, UPDATE, DELETE happens an event is sent to a notification library which sends those updates out via websocket, a client version of this handles updates of the cache (or if you like vuex state, previously ngrx-data cache).
The notification library also handles scoped status updates.
Imagine a multi-community site. You're currently in community A and don't care about what happens in community B, the client tells the server "I'm in A" the server notifies the client only about the latest happenings in scope community A. Once you navigate to community B you do a fetch from the server to get the latest version of the truth. But while you're there you're also telling the server "I'm in B, send me real time updates about B". I'm not a fan of Redis. I like MongoDB and having a single database system for everything. Since I'm not into game development that's good enough.
Postgres is nice for querying, I like SQL more than Mongo's way to query but when developing running migrations, database updates, it's a PITA, especially in Go which seems to lack tooling for this and the driver and "o"rm landscape is also a bit barren. |