modularizing server and introduce cli example. - #6
Conversation
There was a problem hiding this comment.
I removed Gulp, as it seemed overkill for just this task.
There was a problem hiding this comment.
but I wanted to add more! :)
There was a problem hiding this comment.
Haha, no problem. I can add it back in :)
There was a problem hiding this comment.
please, also the travis build should probably depends on it.
a0a1349 to
176bf8a
Compare
176bf8a to
024d766
Compare
|
My recent updates resolved:
Still to-do:
|
12fc020 to
992c328
Compare
|
Thanks for making those changes! Will take a closer look at them next week ;) |
There was a problem hiding this comment.
curious why you export them one by one instead of doing (beware, I'm not that up to date on latest Node.js trends):
module.exports {
getAll: function() {
},
// ...
}
There was a problem hiding this comment.
It's certainly fine to do it that way, but common convention in my experience tends to keep indentation as close to the left wall as possible. Nesting inside of module.exports just adds a level that can be quickly removed by extracting the functions.
There was a problem hiding this comment.
what about having the exports as the top then, instead of below each function?
Or even module.exports.getAll = function() {}
I'm curious about which one is more idomatic those days.
There was a problem hiding this comment.
It's one of those situations where you pick it and just be consistent in your own code. The only benefit to one over another is readability, but as these are all common ways of writing JavaScript, they should each offer the same readability to a newcomer.
If you prefer to look at:
module.exports.getAll = function() {
// ...
};I'm happy to go that route 👍
There was a problem hiding this comment.
I always prefer to export everything at the bottom of the file. That way I can go to a file and immediately scroll to the end to see what it's exporting. I would suggest we do it like proppy first suggested:
module.exports = {
getAll: function() {
},
// ...
};
// EOF45bc701 to
77fd19c
Compare
|
stephenplusplus@77fd19c made a few changes:
I caught a bug after upgrading gcloud to 0.8.0: googleapis/google-cloud-node#250, so after a merge and release of the fix, I'll update the gcloud dependency here to 0.8.1 |
There was a problem hiding this comment.
maybe this should live under app/ WDYT?
There was a problem hiding this comment.
Do you mean this individual file or the server directory? mv server apps?
|
Gulp is back, along with minor restructuring:
|
There was a problem hiding this comment.
Is lowercase more the norm?
There was a problem hiding this comment.
If yes, can you git mv instead so we have history?
There was a problem hiding this comment.
It is the norm and sure.
a11df56 to
9083aba
Compare
9083aba to
8763582
Compare
|
Well, I squashed these down in hopes to make doing the Anyway, same changes, just one commit now. |
There was a problem hiding this comment.
my only concern here is that the app directory doesn't include the server sample.
Maybe we could have a flat structure instead.
Have todos.js, server.js and cli/ at the root and tests/ what do you think?
There was a problem hiding this comment.
👍 although this might be uncovering some underlying confusion I'm having. I don't consider the server an app, rather the gcloud integration point, simply always running in the background for the FE implementations to ping.
It does make sense to move it out of server/ just to make it more visible from the frontpage.
There was a problem hiding this comment.
Yes, so maybe:
server.js
todos.js
package.json
tests/
cli/
And consider cli/ as a sub project with it's own README.md and package.json
There was a problem hiding this comment.
Sounds good. If we get to a point that we have multiple (many) examples, we can always shift them into their own directory if we think that's necessary.
|
Flattened! |
There was a problem hiding this comment.
README.md to match the parent?
|
LGTM, just some nits. |
|
Updated! |
There was a problem hiding this comment.
I would put that at the end.
|
At some point I will need to stop commenting and hit that merge button :) |
|
:) hey, they're all for the better! |
|
Travis is bombing: https://travis-ci.org/GoogleCloudPlatform/gcloud-node-todos/builds/38111282 Is this anything I caused? |
|
@stephenplusplus nop, don't worry about travis, because it relies on encrypted credentials it will only work on |
There was a problem hiding this comment.
s/response/payload/? to avoid the confusion between res and response?
There was a problem hiding this comment.
Sorry, I missed that the first time. Fixed!
|
Thanks! |
modularizing server and introduce cli example.
|
And so much congrats for not breaking the build :) |

Following up from googleapis/google-cloud-datastore#50, this sent the server files to a new
/serverdirectory, as well as introduced a CLI example a little more sophisticated than the one from the earlier PR.An easier to look at representation: https://github.com/stephenplusplus/gcloud-node-todos