-
Notifications
You must be signed in to change notification settings - Fork 54
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
Malu's API gets Reviewed #30
base: master
Are you sure you want to change the base?
Conversation
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.
If your app were displaying updates to the data in single-page style, rather than by refreshing, this would be an excellent app--you're doing well, but I wish you had found a solution other than refreshing.
@@ -0,0 +1 @@ | |||
This is my documentation! |
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.
haha, OK! But your documentation should be in your README.md file.
base_url: 'https://evening-beach-72520.herokuapp.com/', | ||
endpoints: [ | ||
{method: "GET", path: "/api", description: "Describes all available endpoints"}, | ||
{method: "GET", path: "/api/profile", description: "Describes all available endpoints"}, |
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.
Your profile doesn't describe available endpoints, it describes you!
} | ||
|
||
// GET /api/cliffs/:cliffId | ||
function retrieve(req, res) { |
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.
unused function. you can get rid of this.
// DELETE /api/cliffs/:cliffId | ||
function destroy(req, res) { | ||
console.log(req.params.id); | ||
db.Cliff.findByIdAndRemove(req.params.id, (err, Cliff) => { |
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.
Usually, you'd use lower-case cliff
for the parameter name.
} | ||
let response = { | ||
message: "Cliff successfully deleted", | ||
} |
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.
Indentation 😭
url: 'api/cliffs', | ||
data: $(this).serialize(), | ||
success: function() { | ||
window.location = '/' |
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.
😭
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.
You could, instead, just render one cliff's worth of data, for the cliff you just saved.
nearestCity: String, | ||
gpsCoords: String, | ||
height: String, | ||
acessibility: String, |
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.
You're missing a c in accessibility--that's why it never saves correctly.
@@ -1,15 +1,15 @@ | |||
// This file allows us to seed our application with data |
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 would be great if your seed file actually did something!
|
||
app.post('/api/cliffs/:id', controllers.cliffs.create); | ||
|
||
app.get('/api/cliffs/:id', controllers.cliffs.retrieve); |
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.
You don't use this and could remove it.
|
||
<!-- Text input--> | ||
<div class="form-group"> | ||
<label class="col-md-4 control-label" for="nearestCity">Nearest City</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
attribute of the label needs to match the id
of the input it's for, not the name
. You should update the id
of the input below this to be nearestCity
.
Id like some feedback on some ideas to render page differently after I submit a form:
Id like some feedback on my back end CRUD functions and how I can use different more efficient code:
Id like some feedback on any DRY code you find: