Create an Express application that incorporates a third party API, OMDB. [express, api]
We'll be creating an app that connects to the OMDB, a public movie API.
$ npm install omdb
- Fork and clone this repository, which has a starter app provided for you.
- Run
npm installto install dependencies- If installed,
nodemonshould start and refresh your app when changes are made - Use eslint if you'd like to lint your JS
npm run lint:js- lint your JS- Note that from here on out, the JS linter will automatically fix most issues with spacing, quotations, and semicolons. More information here
- Use csslint if you'd like to lint your CSS
npm run lint:css- lint your CSS
- If installed,
- Read the API documentation.
- As a user, I want to go to a home page to search a database full of movies.
- As a user, I want to see movie results based on my search query.
- As a user, I want to pick a movie result and see detailed information about the movie.
- On your home page, create a form. The form will ask for the user to input a movie title.
- This form should have a
GETmethod, with an action of/results - Example result of submitting the form: sends browser to
/results?q=star+wars&apikey=thewdb
- Write your GET route for
/results.
- Use
req.queryto access querystring parameters. - Use the
requestmodule to make a request to the OMDB API with this data - Send the data back to the browser. Use
res.renderand use an ejs template
- From the search results page, we notice along with every movie entry
there is a IMDBid. In the rendered HTML for
/results, have each movie link to a route like/movies/tt234323(wherett234323is the IMDBid).
- Make a new route
/movies/:movie_id - Make an API call to retrieve movie details related to that
movie_id
-
The
dataobject we get back in arequestcallback, is astringof the data. UseJSON.parse(data)to turn that data back into an object. -
The movie api returns an array of movies inside the
SearchKey. -
Make sure you call
res.renderinside the callback function of the request.
- Add stars images to reflect the imdb ratings
- Figure out what parameters are need to access the Rotten Tomato information, and display that information to the page
- Add the ability for users to add movies to a favorites list, and save that list as a JSON file
- All content is licensed under a CC-BY-NC-SA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact legal@ga.co.