Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature1 #9

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion app/models/SubjectViews.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// define our nerd model
// module.exports allows us to pass this to other files when it is called
module.exports = connectionsubject.model('', {}, 'projects');
// module.exports = connectionsubject.model('', {}, 'projects');
16 changes: 9 additions & 7 deletions app/routes.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
var Subjects = require('./models/SubjectViews');
var CircularJSON = require('circular-json');

module.exports = function(app) {

// server routes ===========================================================
// handle things like api calls
// authentication routes
// authentication routes
// sample api route
app.get('/api/data', function(req, res) {
// use mongoose to get all nerds in the database
Subjects.find({}, {'_id': 0, 'school_state': 1, 'resource_type': 1, 'poverty_level': 1, 'date_posted': 1, 'total_donations': 1, 'funding_status': 1, 'grade_level': 1}, function(err, subjectDetails) {
// if there is an error retrieving, send the error.
collection.find({},{'_id': 0, 'school_state': 1, 'resource_type': 1, 'poverty_level': 1, 'date_posted': 1, 'total_donations': 1, 'funding_status': 1, 'grade_level': 1}).limit(100).toArray(function(err, subjectDetails) {
// if there is an error retrieving, send the error.
// nothing after res.send(err) will execute
if (err)
if (err)
res.send(err);
res.json(subjectDetails); // return all nerds in JSON format
let json = CircularJSON.stringify(subjectDetails);
res.send(json); // return all nerds in JSON format
});
});





// frontend routes =========================================================
app.get('*', function(req, res) {
res.sendfile('./public/login.html');
});
}
}
15 changes: 15 additions & 0 deletions node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions node_modules/.bin/semver.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading