ianhaggerty / backbone-sails

A plugin for Backbone that makes integrating with Sails JS easier. Both leverage a model-view architecture, it's only natural to have them talk to each other.
MIT License
7 stars 1 forks source link

Separate the blueprints to another repository #3

Closed Josebaseba closed 9 years ago

Josebaseba commented 9 years ago

Hey!

That's a really awesome work, the project and the docs!!

I think that it would be interesting if you separate the blueprints to another repository just to make a git clone http://whaterver (inside of /api folder of our projects), instead of a copy paste of blueprints folder after downloading all this repo.

That will be cleaner and easier to start using your custom blueprints...

Btw, from where can I download the Backbone.Sails.js file? I've only found the Backbone.Sails.coffee file. Maybe it will be interesting to use another repo for that too, or adding it to Bower also.

Really cool job!

ianhaggerty commented 9 years ago

Hello

Thanks for your interest!

This plugin is beginning gain a few users now and I am still currently in the process of nailing down the API, blueprints, policies etc...

Bringing the blueprints out to another repository is an idea... and bower is definitely on the todo list.

My current priority is completing the front-end doc's for the plugin. The glue between Sails & Backbone needs a lot of careful thought, as well as the policy to adopt for the blueprints (like whether update permissions allow you to add, are double nest's permitted, where does the populate criteria go, etc).

There is a build currently available here.

ianhaggerty commented 9 years ago

Just pushed a zip file to the release folder where you can download the blueprints without having to clone all the time.

Going to try and formalise the release cycle/javascript package managers after a careful review of the blueprints. This is my first real plugin - so I am still learning ;)

I'll leave this open for the time being.

Josebaseba commented 9 years ago

Great! That's a really useful solution.

The project has the potencial to become a real clean solution for Backbone + Sails (+ React :+1:).

I think that we can close this "issue".

hardchor commented 9 years ago

The blueprints should really live in a Sails generator. Also, is it possible to inherit from the original sails blueprints rather than override them given the modifications you've made to them?

We've started using Backbone.Sails a little more extensively now on a new project and I've noticed that this repo contains an entire sails app (as opposed to just the client side code). Would it be feasible to move the app into its own repo (as a demo) and leave the client-side code on its own?

P.S.: Awesome work. I'm digging deeper and deeper into the code and really appreciate your tremendous efforts so far!

ianhaggerty commented 9 years ago

Thanks for your comments! Always good motivation for me. Unfortunately I don't have a huge amount of time in the run up to exams (I am a personal tutor) to work on this project.

With regard to your suggestions. There isn't really anyway to 'extend' the default Sails blueprints. They take the response object, and inevitably return a response. There is no fall through to other middle-ware. Even is I was to omit the response and edit from there, it would inevitably mean more callbacks & slower response times.

I did try not to edit them (trust me), but it was proving a nightmare trying to incorporate features which complement front-end development. A decent example is the add blueprint. By default, it'll return the model added to (with any population requested), but it doesn't necessarily mean the model added is returned to you! I've worked around this with a header for now, regardless of populate criteria, allowing model.addTo("attr", aNewModel) to behave as intended. Both the model added to and the new model (which has been created and added) are updated - as you'd expect. One example of many I'm afraid.

As such, the front and back end are always going to be tightly coupled for a project like this. So I am reluctant to pull it apart into two repositories. You'll find the blueprints I wrote to behave the same as the default for the most part, so they should function as a drop in replacement most of the time. I'd like to say that with a little more conviction, but the behaviour of the blueprints were never well defined in the first place. Only now in the Sails v0.11 release are the docs beginning to mature, but there is still a lot to be desired.

The repo is a sails app mainly because it has the build system (and more importantly jasmine tests) prepped and ready to go for anyone who'd like to contribute. I am considering making a little website, which'll prettify the docs & provide convenient links to download the front & back end code. I wouldn't recommend cloning this repo and then building from there. Just download the release and unzip into your project folder. You'll need to tell your pipeline to include backbone.sails, but that's about it.

ianhaggerty commented 9 years ago

*I don't know much about Sails generators but will look into it in the near future.