diff --git a/models/Article.js b/models/Article.js index 500e04e..7140dd7 100644 --- a/models/Article.js +++ b/models/Article.js @@ -20,7 +20,11 @@ const ArticleSchema = new Schema({ type: String, required: true }, - identifier: { + category: { + type: String, + required: true + }, + criteria: { type: String, required: true }, diff --git a/public/app.js b/public/app.js index 2e2f1de..70b593d 100644 --- a/public/app.js +++ b/public/app.js @@ -1,9 +1,12 @@ // grab articles from db based on localstorage terms -console.log(localStorage.getItem('category')); -console.log(localStorage.getItem('criteria')); +// console.log(localStorage.getItem('category')); +// console.log(localStorage.getItem('criteria')); if ( localStorage.getItem('category') != null ) { + + console.log('getting data!'); $.getJSON(`/articles/${localStorage.getItem('category')}/${localStorage.getItem('criteria')}`, data => { + console.log(data); // append articles to page on load for (var i = 0; i < data.length; i++) { $("#articles").append(`
${data[i].title}
Link to Ad
${data[i].price}