Conversation
|
From the structure perspective, I prefer to see some isolations at directory level instead of file level. For example, Did you look at https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub? |
|
Directory level organization seems to be the winner so far. We can't really call it "client" though. You might have 10 clients and just one of them is angular app. |
There was a problem hiding this comment.
Static middleware must be always the last request handling middleware, registered just before loopback.urlNotFound and loopback.errorHandler. Otherwise every HTTP request hits the disk to check if there is a file matching the requested URL.
|
I agree with @raymondfeng, moving server-specific files and angular-client-specific files to isolated directories would help.
What other html5-based clients do you expect? If there is only one html5 client and the other clients are native apps, then perhaps "client" subdirectory of the http/web server app is not that confusing. We can use a different name by combining one of "web", "browser", "angular", "html5" with "app" or "client". E.g. I would like to structure the files as functional/logical blocks, e.g. all files for the "User" model should be close together, as opposed to spreading the files across common/client/server directories. |
There was a problem hiding this comment.
The configuration of loopback.Remote connector must be kept outside of app.browser.js as it will differ between environments (dev, staging, production). Can the server app inject the config when serving the SPA bundle? That way it's possible to deploy the same set of source files to different environments, without having to re-build app.browser.js at deploy time.
|
I like @bajtos proposed structure. @seanbrookes @raymondfeng thoughts? |
|
@bajtos some comments inline: I guess my issue with the strict separation is that ideally you just write JavaScript against an interface. You shouldn't have to write "browser js" and "server js" at the app level. Maybe in plugins / modules you should do this...? Just thinking out loud really. On the other hand, the strict separation is very clear and easy to understand / reason with. |
I suppose you can have three sets of tests:
If your model is "pure" and does not use anything client or server specific, then pure unit-tests are probably sufficient and you can run them in both environments. I find it difficult to think through all details in advance, we will get the best feedback when we write the first model. I was thinking about an encapsulated client app (a single-page app) that interacts with the server exclusively via the REST API. Something similar to what Trello is doing (link). In which case there are no shared templates. What would you like to share? Yes, this should be pure JS code that can be used in all environments. The idea is building on top of Raymond's proposal. I am sure it can be improved a lot. Maybe instead of |
|
Ad 2b3b144 - bower_components should be IMO git-ignored in the same way as node_modules. |
|
The new structure looks great 👏 |
|
Here are the steps needed to keep bower dependencies outside of git:
|
|
@ritch could you please merge the first version without replication? That way I can start my work on extracting LoopBack - AngularJS integration into a standalone module that can be refactored into SDK later. |
html5: Fix gulp build to create build/ directory
/to @raymondfeng @bajtos @seanbrookes
/cc @altsang
Looking for feedback on the list below. A code review would not be helpful at this point as things are going to change drastically.
Need Feedback on the Following:
TBD Still In Progress