{"id":24568905,"url":"https://github.com/bitliner/yocrud","last_synced_at":"2025-03-17T05:27:54.242Z","repository":{"id":7228845,"uuid":"8537113","full_name":"bitliner/YoCrud","owner":"bitliner","description":"Code generator to build fast an Express based webapp","archived":false,"fork":false,"pushed_at":"2013-03-05T17:41:30.000Z","size":8350,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-25T11:41:51.071Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitliner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-03T14:11:39.000Z","updated_at":"2015-01-18T21:31:33.000Z","dependencies_parsed_at":"2022-09-15T20:02:27.935Z","dependency_job_id":null,"html_url":"https://github.com/bitliner/YoCrud","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitliner%2FYoCrud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitliner%2FYoCrud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitliner%2FYoCrud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitliner%2FYoCrud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitliner","download_url":"https://codeload.github.com/bitliner/YoCrud/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243978976,"owners_count":20378131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-23T14:55:43.557Z","updated_at":"2025-03-17T05:27:54.223Z","avatar_url":"https://github.com/bitliner.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YoCrud\nIt is a yeoman generator to generate automatically code about dao, routes, angular resources, angular controllers, mongoose models.\n\n## Installation\n\nFirst install yeoman\n\n`npm install -g yeoman`\n\nThen create a Gruntfile.js needed by yeoman to find yocrud\n\n`touch Gruntfile.js` \n\nFinally install yocrud\n\n`npm install yocrud`\n\n## Usage\n\nYou can choose to invoke a single generator among 4 generators: dao, route, angular, model or to invoke them all in series.\n\nIf you want to invoke all generatos run\n\n`yeoman init yocrud \u003cname\u003e`\n\nwhere `\u003cname\u003e` is the name of your app.\n\nFor example, if you mant an app to handle books, run `yeoman init yocrud Book`. \n\nOtherwise you can invoke a single generator:\n\n`yeoman init yocrud:\u003cname of generator\u003e \u003cname\u003e`\n\nwhere `\u003cname of a generator\u003e` can be dao, angular, route or model.\n\nBelow you can find documentation about the single generators.\n\n### Model generator\n\nThis generator creates a file that contains model declarations for mongoose. Tipically, if you run `yeoman init yocrud:model Book`, it generates the file model/Book.js and its content will be:\n\n```\nvar mongoose = require('mongoose')\n,       Schema = mongoose.Schema\n,       DB=require('./DB.js')\n\nfunction BookSchema=new Schema({},{ strict:false  })\n\nmongoose.model( 'Book' , BookSchema )\n\nfunction Book(){\n        return DB.model( 'Book' )\n}\n```  \n\n### Dao generator\nIt generates code to query and save a model to MongoDb via mongoose. \n\nIf you run `yeoman init yocrud:dao Book` it will generate the file dao/BookDao.js and its content will be\n\n```\n\nvar Model=require('../model/'+Book+'js')\n\n\nfunction BookDao(){}\n\nBookDao.prototype.save(obj, cb){\n\tvar model=new Model(obj)\n\tmodel.save(cb)\n}\n\nBookDao.prototype.query(query, cb){\n\tModel.find(query,cb)\n}\n\nBookDao.prototype.get(query, cb){\n\tModel.findOne(query,cb)\n}\n\nBookDao.prototype.update(query, update, cb){\n\tModel.update(query, update,cb)\n}\n\nBookDao.prototype.remove(query,cb){\n\tModel.remove(query,cb)\n}\n\nmodule.exports=BookDao\n```\n\n### Route generator\nIt generates code that consists in http handlers (according to REST style).\n \nIf you run `yeoman init yocrud:route Book` it will generates route/BookRoute.js whose content is:\n\n```\nvar ModelDao=require('../dao/'+Book+'Dao.js')\n\nfunction BookRoute=function(options){\n\toptions.app.get('/'+Book,this.get)\n\toptions.app.get('/'+Book+'/:_id',this.getSingle)\n\toptions.app.put('/'+Book+'/:_id',this.update)\n\toptions.app.post('/'+Book,this.save)\t\n}\n\nBookRoute.prototype.get=function(req,res,next){\n\tModelDao.query(req.query,function(err,docs){\n\t\t(err)?res.json(500,err):res.json(200,docs)\n\t\t})\n}\n\nBookRoute.prototype.getSingle=function(req,res,next){\n\tModelDao.query({_id:req.params._id},function(err,doc){\n\t\t(err)?res.json(500,err):res.json(200,doc)\n\t})\n}\n\nBookRoute.prototype.remove=function(req,res,next){\n\tModelDao.remove(req.body,function(err){\n\t\t(err)?res.json(500,err):res.json(200,{success:'ok'})\n\t\t})\n}\n\nBookRoute.prototype.update=function(req,res,next){\n\tModelDao.update(req.body._id,req.body,function(err){\n\t\t(err)?res.json(500,err):res.json(200,{success:'ok'})\n\t})\n}\n\nBookRoute.prototype.save=function(req,res,next){\n\tModelDao.save(req.body,function(err,doc){\n\t\t(err)?res.json(500,err):res.json(200,doc)\n\t})\n}\n\n```\n\n## TODO\n\n* example app\n* better integration with angular\n* USAGE files\n* generation of a index.html page \n* better integration with bootstrap\n* better README.md\n* testing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitliner%2Fyocrud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitliner%2Fyocrud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitliner%2Fyocrud/lists"}