Coder Social home page Coder Social logo

Comments (10)

tgaff avatar tgaff commented on September 14, 2024

I think we said we'd go with 3, but I'm not sure we got consensus there.

from shared_modules.

jlopker avatar jlopker commented on September 14, 2024

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.

tgaff avatar tgaff commented on September 14, 2024

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.

tgaff avatar tgaff commented on September 14, 2024

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.

tgaff avatar tgaff commented on September 14, 2024

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.

tgaff avatar tgaff commented on September 14, 2024

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.

tgaff avatar tgaff commented on September 14, 2024

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.

tgaff avatar tgaff commented on September 14, 2024

We can still discuss introducing controllers and maybe Router later-on. (maybe around the time we get 2 models)

from shared_modules.

tgaff avatar tgaff commented on September 14, 2024

🐫 🌵 🍰 🍜 🐪 🐉 🎤 💯 👍 🐰 👯 🐫 🌵 🍰 🍜 🐪 🐉 🎤 💯 👍 🐰 👯

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.

tgaff avatar tgaff commented on September 14, 2024

This is answered. Closing.

from shared_modules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.