-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forget todos and align all examples to building a store #2049
Comments
@cloudwheels thank you for the proposal. IIRC, we created I like your proposal to use a somewhat more realistic scenario. The tricky part is how to keep the example simple, so that people reading the code can quickly discover the relevant parts & understand what's just a boilerplate, and to keep the maintenance costs low. So perhaps we should rename @strongloop/loopback-maintainers thoughts? @cloudwheels once we reach an agreement on the direction, would you like to contribute these changes yourself please? |
@bajtos all your hard work very much appreciated and I will do my best to find some hours! Looking at the current structure of docs:
It could be nice to move on rapidly from the getting started page or even replace hello world / ping by jumping straight in with a simple user/ customer model, controller, repository and memory connector (the current todo) so I start POSTing my name & getting get a back a slightly more exciting "hello cloudwheels!" With the generators that could be a working example running locally in a few minutes (or ideally in the cloud after another 30 seconds setting up some free tier Bluemix credentials with any of my favourite email addesses :) [One problem here is that this 'proper' auth is probably something that gets implemented OOTB before too long and becomes 'part' of lb4 and I don't really need to do it, because you have :) (although that could be a nice demo of extensions in itself to see how that's done in the reference implementation). ] With a change of domains to order/customerOrder list, product/product variant etc. you can just have one "The Store Example" section, demo-ing in steps of one or a few related 'concepts' and or 'howtos' at time how to rapidly achieve functionality: a more code first approach, e.g (very very very loosely)
Actually the logic in implementing one to many first is obvious when you try to think of simple many-to-many & one-to-one examples in the store domain without over-complicating the model: I'm sure there are plenty, but off the top of my head easier examples would be thing like books/records - authors/artists, author - Booker prize winners, so it may help to think in advance about what our store is selling to give a richer tapestry of more examples to work with using product details, for example, and also make it a bit more memorable and interesting than {"title": "product1"} (think ng heroes). I don't have any Pets and I probably wouldn't want to buy one from an online store (maybe their accessories) but I guess as themes go it is out there
Agreed. Limiting the domains would help think : Customers (really User/Roles), Products (?with variants) , Orders (via ShoppingCart for other reasons), maybe Payments (again for other demo purposes). Even with those limitations it would (I think) still be possible to deliver an 'End to End' experience within the built sample by 'selling' a digital 'product' served from an authorised static route. I think a lot of this work (initially at least) is ctrl+H stuff if todos become users/Orders etc, which can be decoupled from developing the example logic completely, so sure I can start there once you know the exact direction! Better practice is probably recreating the app from scratch in accordance with the updated docs anyway, to ensure that it all works in practice when the instructions are followed? |
Previous comment edited to try to get to grips with how docs & samples fit together and can be reworked now, and what the bigger picture might be longer term. |
Hmm, my 2 cents on this ... Todo, Todo-List example should be left as is and a tutorial should be implemented for Here’s the link to the repo: https://github.com/strongloop/loopback4-example-shopping |
Is the plan to lerna import the shopping example repo into loopback-next/examples? Also, semantics I know, but "Shopping" or "Store"?, "Example" or "Tutorial"? Actually this whole issue is really semantics: as with avoiding too much boilerplate cluttering an explanation of the concepts, does effectively telling the user, even though they almost certainly understand, "So far in other examples, we've been calling these 'Todos', but now we're calling them 'Orders'- don't worry were talking about the same concept of child relations", not just add an unnecessary thinking step vs just consistently calling them Orders across all examples? It's also pretty low hanging fruit to make that change now vs 2 years of example building & tutorials later! I also understand talk is cheap: I personally am more than happy to work through regenerating the sample apps with different entity names (which but nature should be a smooth & rapid process!) and work on updating docs and links for my own education / contribution :) The possible need to revise folder structure for tutorials / examples / how tos / concepts is closely linked to #1908. |
@virkt25 Yes, "Stepped tutorial" is the phrase I was looking for. Step 1Let's get started building our store by installing loopback and creating a controller We'll learn how to:
Installing Loopback CLIDo this and that #Creating a loopback Application #Creating a Model Creating a controllerServing static pagesStep 2Let's move on with or store to do this that and the other....
In this step we'll create models for the products in our store and a shopping cart, then set up basic authentication so customers can sign in and manage their own orders. Adding One-to-many relations: Create a product list and user order listCreate Product model Adding Basic Authentication to the store with [@loopback/authentication]I.E.
|
This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the |
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the |
Description / Steps to reproduce / Feature proposal
Current starter examples are based around the concept of todos and their relationships in todoLists. No doubt chosen for the relative simplicity of the concept.
From my understanding of the roadmap and current activity, the aim is to primarily demonstrate the product's production-ready capabilities through a reference implementation of an e-commerce store api backend shopping sample?
IMHO it would make more sense to start the examples with say Products and Product Variations (Orders, OrderProducts etc) to align to this and progress through one project until I've build my store, Angular Heroes style.
Then when I move on to the next step I'm authorising adding Products to an Order etc., not adding "buying milk" to my OAuth2 authenticated cloud-distributed todo list of my chosen colour. The.Real.World. LargeRedTShirt-SmallBlueTShirt. :)
.
This can be achieved quickly just by renaming Todo Product Variation and TodoList Product or whatever:
I also think is actually is a genuine one-to-many relationship for exploring related models, whereas I would probably implement todos and lists as many-to-many from the start to cover use cases of sharing items between lists.
Thanks for listening.
The text was updated successfully, but these errors were encountered: