-
Notifications
You must be signed in to change notification settings - Fork 54
I want to review your code #34
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
base: master
Are you sure you want to change the base?
Conversation
…r data and complete app.js
server.js
Outdated
| }) | ||
| }); | ||
|
|
||
| // app.get('api/motorcycleList', controllers.motorcycleList.index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks correct, you can probably uncomment it, may or may not need to add a '/' in front of api
| @@ -0,0 +1,87 @@ | |||
| /*********** | |||
| * DATABASE * | |||
| ************/ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add something like this to grab all your models/database tables:
var db = require('../models');
| // GET /api/albums | ||
| function index(req, res) { | ||
| // send back all albums as JSON | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add something like this to grab data from your database, probably need to add data into the database first or seed it?
db.Profile.find({}, function(err, dataReturned) {
res.json(dataReturned);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
|
||
| $(document).ready(function(){ | ||
| console.log('app.js is loaded!'); | ||
| $.ajax({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good here, the process to grab data from the database goes from
- app.js, look for an ajax call
- look into server.js for a route that matches with method and url
- look at the route for a controller and function
- look into the controller for the function and add the logic to grab the data
- if you want to return JSON, you can do res.json(dataReturned) in your controller function or use success like you did here
mnfmnfm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like you had trouble getting any part of your API working--this is really concerning. This project isn't close to meeting expectations.
| // GET /api/albums | ||
| function index(req, res) { | ||
| // send back all albums as JSON | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| var mongoose = require('mongoose'), | ||
| Schema = mongoose.Schema; | ||
|
|
||
| const ProfileSchema = new Schema ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this is data about a motorcycle; why is it in a file called Profile?
| }); | ||
|
|
||
| //Need to resolve this issue here, when I run node seed.js | ||
| //I'm getting an error that .remove() is undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because what you export is called Profile, not List. An even better name might be Motorcycle.
|
|
||
| <!-- Text input--> | ||
| <div class="form-group"> | ||
| <label class="col-md-4 control-label" for="weight">Max Torque:</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "for" here makes it obvious that this was copy/pasted and never tested
| <div class="form-group"> | ||
| <label class="col-md-4 control-label" for="engineDisplacement">Engine Displacement (Cylinder Capacity or Cubic Centimeters):</label> | ||
| <div class="col-md-4"> | ||
| <textarea class="form-control" id="engineDisplacement" name="engine displacement">for ex: 999cc</textarea> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Names shouldn't be multiple words
Please