generator-mongoose
v2.0.3
Published
A mongoose schema generator for Yeoman
Downloads
20
Maintainers
Readme
generator-mongoose
![Gitter](https://badges.gitter.im/Join Chat.svg)
A generator for Yeoman.
Getting Started
What is Yeoman?
Trick question. It's not a thing. It's this guy:
Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.
Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things.
$ npm install -g yo
Generator Mongoose
While running through a leafy mongodb field he picked up mongoose.
To install generator-mongoose from npm, run:
$ npm install -g generator-mongoose
Finally, initiate the generator:
$ yo mongoose
It should output a file structure similiar to:
.bowerrc
.editorconfig
.jshintrc
config/
- db.js
public/
css/
- style.css
js/
- script.js
models/
- post.js
routes/
- index.js
- post.js
test/
- test-post.js
views/
- index.html
bower.json
Gruntfile.js
package.json
Readme.md
Run the app
Development mode
$ grunt
or
$ grunt server
Production mode
$ grunt prod
Sub Generator Schema
Run the sub generator for schemas:
$ yo mongoose:schema "article|title:String,excerpt:String,content:String,published:Boolean,created:Date"
output:
You're creating a schema for article
With the fields: title,excerpt,content,published,created
create routes/article.js
create models/article.js
starting request to schematic for test mock data...
create test/test-article.js
Getting To Know Yeoman
Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced.
If you'd like to get to know Yeoman better and meet some of his friends, Grunt and Bower, check out the complete Getting Started Guide.