Giter Site home page Giter Site logo

madmen's People

Contributors

jasonmanners avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

andrewyu0

madmen's Issues

Extend for all CRUD actions

The following controller actions should be written

  • new
  • create
  • show
  • edit
  • update
  • delete

How to write a generic aciton

The controller actions are generic so we only need to write a single set regardless of how many resources Madmen is managing. To achieve this we bind the model name as the first parameter to the controller actions like so:

app.get('/index', controller.index.bind(null,'User'));

We can then use that model name to dynamically grab the mongoose model to perform the correct actions:

var index = function(modelName, req, res) {
  var resource = mongoose.model(modelName);
  // Other stuff here
}

New/Edit form

In order to make this as generic as possible we will be using JSON to create new/update existing documents. All we need in the form for now is a textarea.
Once you get the basic controller actions working I will help you setup the actual create/update functionality.

Things to note

You can use OctoAvenger as an example for the inner workings of the controller actions but use the controller.index currently in madmen as a reference for defining the parameters and how to get the mongoose model.

The views should just be super super basic for now, similar to index.jade. We will extend the views and make it look awesome as soon as we get the basic functionality in and can use it to manage resources.

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.