Comments (10)
I think we said we'd go with 3, but I'm not sure we got consensus there.
from shared_modules.
i think i'm leaning towards 2. it's not a huge amount of more files and i would rather not have to deal with the confusion later. i also think that this pattern would help with understanding MVC. but i'm willing to be convinced of something else.
from shared_modules.
Nathan said:
" One option might be to separate out controllers starting with MEAN stack. And use inline functions from day one so they get familiar with naming conventions: eg todoShow, todoIndex, etc.
We should consider stubbing empty controllers, a la rails, especially because of export/import. Plus it would enforce REST pattern. "
from shared_modules.
A loose lunchtime poll showed that:
Justin: is somewhat on the fence but leaning toward 3 (delay and ask Nathan to do it the next day)
Cory: Willing to let us choose.
Brianna: Very much in favor of the Router and controllers.
Juliana: Doesn't like router but likes the idea of controllers in separate files. (Note: maybe I misunderstood since this conflicts a little with @jlopker above)
from shared_modules.
I've added an example to Tuesday's TodoApp. https://github.com/SF-WDI-LABS/test-driven-todo-api/blob/use_separate_controllers_no_router/server.js
This:
- does not use Router
- does use module-pattern and external controllers
- was slapped together really fast...could be improved
@jlopker is this what you meant?
from shared_modules.
5: Juliana suggested what I'm calling a namespace-less mountable app (no router) She also suggested calling the files resources
instead of controllers
:
module.exports = function(app) {
app.get('/api/admin/unconfirmed-users', auth.ensureAuthenticated, auth.ensureAdmin, function (req, res) {
User.find({ confirmedAt: null }, '+email').exec(function (err, users) {
res.send(users)
})
})
}
from shared_modules.
OK. Nathan is out on Monday and unavailable for comment. If we changed Monday's lesson, that would force @cofauver to change Tuesday's and then Nathan would arrive Tuesday morning to find that we'd pulled the rug out from under him. I would hate to have that happen to me and don't want to do it to him. Plus I think Cory is still getting up to speed a little bit and asking him to change it all at last minute on the weekend seems a little sad.
from shared_modules.
We can still discuss introducing controllers and maybe Router later-on. (maybe around the time we get 2 models)
from shared_modules.
🐫 🌵 🍰 🍜 🐪 🐉 🎤 💯 👍 🐰 👯 🐫 🌵 🍰 🍜 🐪 🐉 🎤 💯 👍 🐰 👯
So a meeting of 4 today (BV, JL, CF, TG) determined that on Thursday afternoon the module pattern would be introduced and we'd go with:
- controllers from then on (using module pattern)
- no Express Router
- server.js is effectively a router
Effectively that's the example here: https://github.com/SF-WDI-LABS/test-driven-todo-api/blob/use_separate_controllers_no_router/server.js but with a few minor changes like require
each controller separately and name functions 'index', 'show', 'create' etc.
That puts this right after learning mongoose and therefore reinfoces module pattern. It also is reasonably Railsy.
from shared_modules.
This is answered. Closing.
from shared_modules.
Related Issues (20)
- SQL intro (v27)
- password confirmation has no validation HOT 3
- paperclip instructions HOT 2
- Paperclip instructions should point to general secret key doc HOT 1
- 27-28_w02-d02-hw HOT 4
- 27-28_w02-d03-hw HOT 1
- 27-28_w02-d04-hw HOT 3
- 27-28_w02-d02-drills Letter Frequency Counter
- 27-28_w02-d01-dawn-js-array-iterators HOT 4
- 27-28_w02-d01-dawn HTTP, HTML Forms, Query params
- Events binding in-class exercises: GA website no longer has jQuery HOT 1
- week 1 assessment problems need review
- Fix formatting (tabs/spaces) on 01-front-end-basics/js-functions-advanced/22
- upgrade handlebars to 4.0.5 HOT 1
- 27-28-js-object-primitives dead image link
- 27-28-w03-d01-HW homework HOT 3
- 27-28-w03-d02-HW homework HOT 5
- 27-28-w03-d03-HW HOT 4
- solution visibility HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shared_modules.