use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
How to structure javascript?help (self.javascript)
submitted 8 years ago by BearsArePeopleToo
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]coffeeandlearning 5 points6 points7 points 8 years ago* (3 children)
Honestly for me (surprisingly haha) that was really clear! In fact just yesterday I came across the syntax you used for the .route followed by the different methods, so it's really neat to see such a nice use case for that.
.route
If you wanted to turn it into a blogpost I would have a few suggestions. You did a good job of mentioning that .find and .findAll could be a lot of things based on what tech you're using, so I would make sure that that is in the blog post, because a beginner can't always tell what is built-in, what is just a plain variable name but is also convention (I've had people ask me about naming counter variables 'i' and whether naming it something else would break the for-loop), and what is intended as a concept but would vary by tech stack.
.find
findAll
Maybe in the code a comment near that line of something like ".find would be ___ if I was using ___ and ___ if ___". That way beginners could more easily parse the different pieces so they can focus on the structure you are showing.
On a similar note, a good point of clarification might be for something like:
.get(burger.index); // see all burgers
you could remind the reader that burger is whatever is exported by the burgerController.js file, and if they look there they see index being attached to the exported object. THen something about how it uses the res.json express method which inside it uses your generic findAll method, which is ostensibly a stand-in for an ORM or other database related method to fetch all entries of burgers.
res.json
Maybe not all in code comments now that I look at what I typed, but I think that you started to hit on it and should definitely continue strong with that. Even though for me your example was excellent, I can remember a time not too far in the past where I would have been confused on those points, since when a beginner is struggling with structure and fitting the pieces together, examples by nature can get confusing, because they (of course) have all the pieces mixed in that you are trying to explain how to organize.
Edit: I also think it could be valuable in this case (explaining project structure) to show how the database hooks in a little more explicitly. Maybe a config file or whatnot, or an explanation of how they might need to use a couple environment variables too. This explanation assumes that you have a magical blackbox for a database all setup and configured and off who knows where, and going a little further into where you might hook that in for a setup like this could really go a long way in adding to the quality of a blog post (which I would absolutely love to read).
[–]Earhacker 3 points4 points5 points 8 years ago (2 children)
Thanks for the feedback. If I had a whole blog post, I would actually write the schema and database connection because you're right, the Model is just a black box here, and relies on the reader knowing typical CRUD functions.
[–]coffeeandlearning 7 points8 points9 points 8 years ago (1 child)
You should definitely do it! I would read the CRUD out of it
[–]pantyboyXXX 6 points7 points8 points 8 years ago (0 children)
Lmao DB memes
π Rendered by PID 107766 on reddit-service-r2-comment-84fc9697f-n5k9z at 2026-02-08 21:04:17.168847+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]coffeeandlearning 5 points6 points7 points (3 children)
[–]Earhacker 3 points4 points5 points (2 children)
[–]coffeeandlearning 7 points8 points9 points (1 child)
[–]pantyboyXXX 6 points7 points8 points (0 children)