A MVC web application Node framework OO Based using Babel
// app/routes.js
export default function Routes() {
this.root('photos#index')
this.resources('photos')
}
// app/controllers/photos.js
import { Controller } from 'crush'
class Photos extends Controller {
index() {
this.render('show')
}
}
export default Photos
// app/views/photos/show.js
export default jbuilder.encode((json) => {
json.set('photo', (json) => {
json.extract(photo, 'id', 'name', 'url')
})
})
// output: {"photo":{"id":1,"name":"my photo","url":"localhost:9000/photos/media/my_photo.png"}}