From:  Allen Unrau <paket.hdr@gmail.com>
Date:  19 Apr 2017 03:35:27 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.mdc
Subject:  

Re: Express local library tutorial

NNTP-Posting-Host:  63.245.214.181

OK, I got it going. Here is what I found:

When I created the models, I copied/pasted the text from the web page. When I compared my models to those on the example repo, I found some differences. The author and bookinstance models had a few virtual functions that weren't on the web, but more importantly they both require 'moment'

var moment = require('moment');

This isn't on the tutorial, not at least up to part 3. I installed moment using npm, re-ran the popuatedb.js script and it worked. 

Thanks for looking into this.


On Tuesday, 18 April 2017 12:44:28 UTC-5, Chris Mills  wrote:
> Hello again Allen,
> 
> I’ve just gone through the instructions again, and they work fine for me. I think the script is talking about definitions for the DB objects taken from the model, rather than the routes, so I don’t think that’s an issue.
> 
> One thought I had - did you save the script in the right place? The instructions were a bit unclear, so I’ve rewritten them slightly. To be exact, the script should be saved in the same directory as the package.json file.
> 
> Other thoughts:
> 
> 1. Did you create all four models as directed?
> 2. Did you install async as directed?
> 3. Check your code against the example repo at https://github.com/mdn/express-locallibrary-tutorial
> 
> Best regards,
> 
> Chris Mills
>  Senior tech writer || Mozilla
> developer.mozilla.org || MDN
>  cmills@mozilla.com || @chrisdavidmills
> 
> > On 12 Apr 2017, at 16:58, Allen Unrau  wrote:
> > 
> > Hello 
> > 
> > I am working through the Express local library tutorial found at https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/Tutorial_local_library_website. I ran into some problems at the end of part 3, where you run the script to populate the database. I downloaded the script, ran it and only got the authors inserted into my database, nothing else. I got these errors on the command line:
> > 
> > FINAL ERR: ValidationError: Path `genre` is required., Path `book` is required.
> > 
> > I can't figure out why the authors worked and the rest didn't. At this point in the tutorial we built routes for /, /users, and /users/cool, so according to how I understand things, nothing should have worked. I also didn't get an error for 'bookinstance' but they weren't inserted into the database either. Can anyone shed some light on what is going on?
> > 
> > I'm going through the 'populatedb.js' code and for each catalog item type (Author, Book, Genre and Bookinstance), I see .save and .push methods being called, presumably to save to the database. Where do these methods come from?
> > 
> > thx
> > _________________________________________________________________________
> > Discussing Developer documentation on MDN: dev-mdc mailing list
> > List email: dev-mdc@lists.mozilla.org
> > Manage your membership: https://lists.mozilla.org/listinfo/dev-mdc
> > Unsubscribe: https://lists.mozilla.org/options/dev-mdc/cmills%40mozilla.com?unsub=1&unsubconfirm=1
> > MDN contributor guide: http://bit.ly/ContributorGuide