jamiemiller8 / project2-movie-api Goto Github PK
View Code? Open in Web Editor NEWREFER TO NEW PROJECT 2 REPOSITORY: movieAPI
Home Page: https://github.com/jamiemiller8/movieAPI
REFER TO NEW PROJECT 2 REPOSITORY: movieAPI
Home Page: https://github.com/jamiemiller8/movieAPI
If I make a request for a movie that's not in your DB, the API just hangs. I.e. if I make a request to /movie/Princess%20Bride
, it should maybe return an error that the movie isn't found.
When I send a PUT
request to /movie/:id
, I get the following error:
ReferenceError: req is not defined
at updateMovie (/Users/zakk/ga/wdi/grading/02-project/jamie/controllers/movie.js:20:38)
at Layer.handle [as handle_request] (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/layer.js:95:5)
at /Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/index.js:281:22
at param (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/index.js:354:14)
at param (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/index.js:365:14)
at Function.process_params (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/index.js:410:3)
at next (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/index.js:174:3)
at router (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/index.js:47:12)
at Layer.handle [as handle_request] (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/index.js:317:13)
at /Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/zakk/ga/wdi/grading/02-project/jamie/node_modules/express/lib/router/index.js:335:12)
project2-movie-api/models/Genre.js
Line 5 in 4c7646f
Mongoose is automatically going to create a property called id
, which may clash with this one
Lines 11 to 13 in 4c7646f
Having a root route like this is a really great idea (great thinking!). Maybe consider having it send documentation to the user? I think that would be the best, but the other option is to redirect them to another route.
project2-movie-api/routes/genre.js
Line 9 in 4c7646f
We typically get a resource by it's id, so I think people would expect something like /genre/:id
to work. Then, to get a document by some other property, we'd add that to the URL (i.e. genre/name/:name
). That might be a cleaner way of doing your paths.
project2-movie-api/routes/movie.js
Lines 5 to 24 in 4c7646f
You've got a lot of stuff in the root of your respository. Consider reorganizing it a bit so the repo looks a little cleaner.
One thing you could do is move the json data and axios/
directory into a data/
directory.
project2-movie-api/routes/movie.js
Lines 5 to 24 in 4c7646f
project2-movie-api/routes/person.js
Lines 8 to 12 in 4c7646f
These two routes are identical! The fact that you've given them separate parameters wont make a difference, any route that would match against either of these will always just match against the first one (because it's first).
Maybe change the route to get a document by it's name to add name
to the path?
router.get('/name/:name', personController.getByName);
You don't want to have commented out code in your repo!
project2-movie-api/models/Movie.js
Lines 14 to 18 in 4c7646f
As a cool bonus, one thing you could do is implement query parameters for your urls. This would let you query for any document based on any property.
So to get by a movie name, you'd make a GET
request to /movie?name=Princess%20Bride
We didn't cover these, so this would be a cool bonus!
project2-movie-api/models/Person.js
Lines 4 to 15 in 4c7646f
This is a really interesting way of defining this model. It might make more sense to have name
and known_for
at the root of your schema, rather than nested under results
. Also, for your genre_ids
property, you probably want to use another ref
.
You currently don't have any documentation on how to get the project setup locally if someone (i.e. an instructor or a potential employer) wanted to do that.
Can you add setup instructions to your README?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.