From 1ea17797ce21c6f5b442bc275211ba8037a5b96c Mon Sep 17 00:00:00 2001 From: lucashemi Date: Tue, 10 Jan 2023 17:05:09 -0300 Subject: first commit --- .../com/alura/DaysOfCodeSpring/ApiController.java | 69 + .../br/com/alura/DaysOfCodeSpring/Application.java | 22 + .../com/alura/DaysOfCodeSpring/HTMLGenerator.java | 55 + .../com/alura/DaysOfCodeSpring/imdbApiClient.java | 27 + src/main/resources/application.properties | 1 + src/main/resources/static/content.html | 2016 ++++++++++++++++++++ src/main/resources/static/main.css | 24 + .../alura/DaysOfCodeSpring/ApplicationTests.java | 32 + 8 files changed, 2246 insertions(+) create mode 100644 src/main/java/br/com/alura/DaysOfCodeSpring/ApiController.java create mode 100644 src/main/java/br/com/alura/DaysOfCodeSpring/Application.java create mode 100644 src/main/java/br/com/alura/DaysOfCodeSpring/HTMLGenerator.java create mode 100644 src/main/java/br/com/alura/DaysOfCodeSpring/imdbApiClient.java create mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/static/content.html create mode 100644 src/main/resources/static/main.css create mode 100644 src/test/java/br/com/alura/DaysOfCodeSpring/ApplicationTests.java (limited to 'src') diff --git a/src/main/java/br/com/alura/DaysOfCodeSpring/ApiController.java b/src/main/java/br/com/alura/DaysOfCodeSpring/ApiController.java new file mode 100644 index 0000000..7111c5d --- /dev/null +++ b/src/main/java/br/com/alura/DaysOfCodeSpring/ApiController.java @@ -0,0 +1,69 @@ +package br.com.alura.DaysOfCodeSpring; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("/imdb") +public class ApiController { + + @Autowired + private imdbApiClient apiClient; + + @Value("${imdb.apiKey}") + private String apiKey; + + private List favoritos = new ArrayList<>(); + + @GetMapping + public ModelAndView getFilmesHTML() throws Exception { + List filmes = apiClient.getBody(apiKey); + + PrintWriter writer = new PrintWriter("src/main/resources/static/content.html"); + new HTMLGenerator(writer).generate(filmes); + writer.close(); + + return new ModelAndView("content.html"); + } + + @GetMapping("/api") + public List getFilmes(@RequestParam(required = false) String titulo) throws Exception { + if (titulo != null) { + return apiClient.getBody(apiKey).stream().filter(f -> titulo.toLowerCase().contains(f.title.toLowerCase())).toList(); + } + return apiClient.getBody(apiKey); + } + + @PostMapping("/favoritos/{id}") + public ResponseEntity addFilmeFavorito(@PathVariable String id) throws Exception { + favoritos.addAll(apiClient.getBody(apiKey).stream().filter(f -> id.equals(f.id)).toList()); + return ResponseEntity.ok().build(); + } + + @GetMapping("/favoritos") + public List getFilmesFavoritos() { + return favoritos; + } + + @GetMapping("/favoritos/{id}") + public List getFilmeFavorito(@PathVariable String id) { + List filme = favoritos.stream().filter(f -> id.equals(f.id)).toList(); + return filme; + } + + @DeleteMapping("/favoritos/{id}") + public List deleteFilmeFavoritos(@PathVariable String id) { + favoritos.removeAll(favoritos.stream().filter(f -> id.equals(f.id)).toList()); + return favoritos; + } + + record Filme(String id, Long rank, String title, String fullTitle, String year, String image, String crew, String imDbRating, Long imDbRatingCount){} + +} diff --git a/src/main/java/br/com/alura/DaysOfCodeSpring/Application.java b/src/main/java/br/com/alura/DaysOfCodeSpring/Application.java new file mode 100644 index 0000000..c016fa1 --- /dev/null +++ b/src/main/java/br/com/alura/DaysOfCodeSpring/Application.java @@ -0,0 +1,22 @@ +package br.com.alura.DaysOfCodeSpring; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestTemplate; + +@SpringBootApplication +public class Application { + + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/src/main/java/br/com/alura/DaysOfCodeSpring/HTMLGenerator.java b/src/main/java/br/com/alura/DaysOfCodeSpring/HTMLGenerator.java new file mode 100644 index 0000000..9e3e42b --- /dev/null +++ b/src/main/java/br/com/alura/DaysOfCodeSpring/HTMLGenerator.java @@ -0,0 +1,55 @@ +package br.com.alura.DaysOfCodeSpring; + +import java.io.PrintWriter; +import java.util.List; + +public class HTMLGenerator { + private PrintWriter writer; + + public HTMLGenerator(PrintWriter writer) { + this.writer = writer; + } + + private String head = + """ + + + + + + + + """; + + private String card = + """ +
+

%s

+
+ %ss +

Nota: %s - Ano: %s

+
+
+ """; + + public void generate(List filmes) { + writer.println(head); + + writer.println(""" + +

IMDb

+
+ """); + + filmes.forEach(filme -> { + writer.println(String.format(card, filme.title(), filme.image(), filme.title(), filme.imDbRating(), filme.year())); + }); + + writer.println( + """ +
+ + + """); + } +} diff --git a/src/main/java/br/com/alura/DaysOfCodeSpring/imdbApiClient.java b/src/main/java/br/com/alura/DaysOfCodeSpring/imdbApiClient.java new file mode 100644 index 0000000..d7db714 --- /dev/null +++ b/src/main/java/br/com/alura/DaysOfCodeSpring/imdbApiClient.java @@ -0,0 +1,27 @@ +package br.com.alura.DaysOfCodeSpring; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.Arrays; +import java.util.List; + +@Component +public class imdbApiClient { + + @Autowired + public RestTemplate restTemplate; + + public List getBody(String apiKey) throws JsonProcessingException { + String url = "https://imdb-api.com/en/API/Top250Movies/"; + ResponseEntity response = restTemplate.getForEntity(url + apiKey, String.class); + String parsed = response.getBody().substring(9,response.getBody().length() - 19); + + ObjectMapper objectMapper = new ObjectMapper(); + return Arrays.stream(objectMapper.readValue(parsed, ApiController.Filme[].class)).toList(); + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..f6dcfc2 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1 @@ +imdb.apiKey= diff --git a/src/main/resources/static/content.html b/src/main/resources/static/content.html new file mode 100644 index 0000000..0a015b9 --- /dev/null +++ b/src/main/resources/static/content.html @@ -0,0 +1,2016 @@ + + + + + + + + + +

IMDb

+
+ +
+

The Shawshank Redemption

+
+ The Shawshank Redemptions +

Nota: 9.2 - Ano: 1994

+
+
+ +
+

The Godfather

+
+ The Godfathers +

Nota: 9.2 - Ano: 1972

+
+
+ +
+

The Dark Knight

+
+ The Dark Knights +

Nota: 9.0 - Ano: 2008

+
+
+ +
+

The Godfather: Part II

+
+ The Godfather: Part IIs +

Nota: 9.0 - Ano: 1974

+
+
+ +
+

12 Angry Men

+
+ 12 Angry Mens +

Nota: 9.0 - Ano: 1957

+
+
+ +
+

Schindler's List

+
+ Schindler's Lists +

Nota: 8.9 - Ano: 1993

+
+
+ +
+

The Lord of the Rings: The Return of the King

+
+ The Lord of the Rings: The Return of the Kings +

Nota: 8.9 - Ano: 2003

+
+
+ +
+

Pulp Fiction

+
+ Pulp Fictions +

Nota: 8.8 - Ano: 1994

+
+
+ +
+

The Lord of the Rings: The Fellowship of the Ring

+
+ The Lord of the Rings: The Fellowship of the Rings +

Nota: 8.8 - Ano: 2001

+
+
+ +
+

The Good, the Bad and the Ugly

+
+ The Good, the Bad and the Uglys +

Nota: 8.8 - Ano: 1966

+
+
+ +
+

Forrest Gump

+
+ Forrest Gumps +

Nota: 8.8 - Ano: 1994

+
+
+ +
+

Fight Club

+
+ Fight Clubs +

Nota: 8.7 - Ano: 1999

+
+
+ +
+

The Lord of the Rings: The Two Towers

+
+ The Lord of the Rings: The Two Towerss +

Nota: 8.7 - Ano: 2002

+
+
+ +
+

Inception

+
+ Inceptions +

Nota: 8.7 - Ano: 2010

+
+
+ +
+

Star Wars: Episode V - The Empire Strikes Back

+
+ Star Wars: Episode V - The Empire Strikes Backs +

Nota: 8.7 - Ano: 1980

+
+
+ +
+

The Matrix

+
+ The Matrixs +

Nota: 8.7 - Ano: 1999

+
+
+ +
+

Goodfellas

+
+ Goodfellass +

Nota: 8.7 - Ano: 1990

+
+
+ +
+

One Flew Over the Cuckoo's Nest

+
+ One Flew Over the Cuckoo's Nests +

Nota: 8.6 - Ano: 1975

+
+
+ +
+

Se7en

+
+ Se7ens +

Nota: 8.6 - Ano: 1995

+
+
+ +
+

Seven Samurai

+
+ Seven Samurais +

Nota: 8.6 - Ano: 1954

+
+
+ +
+

It's a Wonderful Life

+
+ It's a Wonderful Lifes +

Nota: 8.6 - Ano: 1946

+
+
+ +
+

The Silence of the Lambs

+
+ The Silence of the Lambss +

Nota: 8.6 - Ano: 1991

+
+
+ +
+

City of God

+
+ City of Gods +

Nota: 8.6 - Ano: 2002

+
+
+ +
+

Saving Private Ryan

+
+ Saving Private Ryans +

Nota: 8.6 - Ano: 1998

+
+
+ +
+

Life Is Beautiful

+
+ Life Is Beautifuls +

Nota: 8.6 - Ano: 1997

+
+
+ +
+

Interstellar

+
+ Interstellars +

Nota: 8.6 - Ano: 2014

+
+
+ +
+

The Green Mile

+
+ The Green Miles +

Nota: 8.6 - Ano: 1999

+
+
+ +
+

Star Wars: Episode IV - A New Hope

+
+ Star Wars: Episode IV - A New Hopes +

Nota: 8.5 - Ano: 1977

+
+
+ +
+

Terminator 2: Judgment Day

+
+ Terminator 2: Judgment Days +

Nota: 8.5 - Ano: 1991

+
+
+ +
+

Back to the Future

+
+ Back to the Futures +

Nota: 8.5 - Ano: 1985

+
+
+ +
+

Spirited Away

+
+ Spirited Aways +

Nota: 8.5 - Ano: 2001

+
+
+ +
+

Psycho

+
+ Psychos +

Nota: 8.5 - Ano: 1960

+
+
+ +
+

The Pianist

+
+ The Pianists +

Nota: 8.5 - Ano: 2002

+
+
+ +
+

Parasite

+
+ Parasites +

Nota: 8.5 - Ano: 2019

+
+
+ +
+

Léon: The Professional

+
+ Léon: The Professionals +

Nota: 8.5 - Ano: 1994

+
+
+ +
+

The Lion King

+
+ The Lion Kings +

Nota: 8.5 - Ano: 1994

+
+
+ +
+

Gladiator

+
+ Gladiators +

Nota: 8.5 - Ano: 2000

+
+
+ +
+

American History X

+
+ American History Xs +

Nota: 8.5 - Ano: 1998

+
+
+ +
+

The Departed

+
+ The Departeds +

Nota: 8.5 - Ano: 2006

+
+
+ +
+

The Usual Suspects

+
+ The Usual Suspectss +

Nota: 8.5 - Ano: 1995

+
+
+ +
+

The Prestige

+
+ The Prestiges +

Nota: 8.5 - Ano: 2006

+
+
+ +
+

Whiplash

+
+ Whiplashs +

Nota: 8.5 - Ano: 2014

+
+
+ +
+

Casablanca

+
+ Casablancas +

Nota: 8.5 - Ano: 1942

+
+
+ +
+

Harakiri

+
+ Harakiris +

Nota: 8.5 - Ano: 1962

+
+
+ +
+

Grave of the Fireflies

+
+ Grave of the Firefliess +

Nota: 8.5 - Ano: 1988

+
+
+ +
+

The Intouchables

+
+ The Intouchabless +

Nota: 8.5 - Ano: 2011

+
+
+ +
+

Modern Times

+
+ Modern Timess +

Nota: 8.4 - Ano: 1936

+
+
+ +
+

Once Upon a Time in the West

+
+ Once Upon a Time in the Wests +

Nota: 8.4 - Ano: 1968

+
+
+ +
+

Rear Window

+
+ Rear Windows +

Nota: 8.4 - Ano: 1954

+
+
+ +
+

Cinema Paradiso

+
+ Cinema Paradisos +

Nota: 8.4 - Ano: 1988

+
+
+ +
+

Alien

+
+ Aliens +

Nota: 8.4 - Ano: 1979

+
+
+ +
+

City Lights

+
+ City Lightss +

Nota: 8.4 - Ano: 1931

+
+
+ +
+

Apocalypse Now

+
+ Apocalypse Nows +

Nota: 8.4 - Ano: 1979

+
+
+ +
+

Memento

+
+ Mementos +

Nota: 8.4 - Ano: 2000

+
+
+ +
+

Django Unchained

+
+ Django Unchaineds +

Nota: 8.4 - Ano: 2012

+
+
+ +
+

Indiana Jones and the Raiders of the Lost Ark

+
+ Indiana Jones and the Raiders of the Lost Arks +

Nota: 8.4 - Ano: 1981

+
+
+ +
+

WALL·E

+
+ WALL·Es +

Nota: 8.4 - Ano: 2008

+
+
+ +
+

The Lives of Others

+
+ The Lives of Otherss +

Nota: 8.4 - Ano: 2006

+
+
+ +
+

Sunset Blvd.

+
+ Sunset Blvd.s +

Nota: 8.4 - Ano: 1950

+
+
+ +
+

Paths of Glory

+
+ Paths of Glorys +

Nota: 8.4 - Ano: 1957

+
+
+ +
+

The Shining

+
+ The Shinings +

Nota: 8.4 - Ano: 1980

+
+
+ +
+

The Great Dictator

+
+ The Great Dictators +

Nota: 8.4 - Ano: 1940

+
+
+ +
+

Avengers: Infinity War

+
+ Avengers: Infinity Wars +

Nota: 8.4 - Ano: 2018

+
+
+ +
+

Witness for the Prosecution

+
+ Witness for the Prosecutions +

Nota: 8.4 - Ano: 1957

+
+
+ +
+

Aliens

+
+ Alienss +

Nota: 8.3 - Ano: 1986

+
+
+ +
+

Spider-Man: Into the Spider-Verse

+
+ Spider-Man: Into the Spider-Verses +

Nota: 8.3 - Ano: 2018

+
+
+ +
+

American Beauty

+
+ American Beautys +

Nota: 8.3 - Ano: 1999

+
+
+ +
+

Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb

+
+ Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bombs +

Nota: 8.3 - Ano: 1964

+
+
+ +
+

The Dark Knight Rises

+
+ The Dark Knight Risess +

Nota: 8.3 - Ano: 2012

+
+
+ +
+

Oldboy

+
+ Oldboys +

Nota: 8.3 - Ano: 2003

+
+
+ +
+

Inglourious Basterds

+
+ Inglourious Basterdss +

Nota: 8.3 - Ano: 2009

+
+
+ +
+

Amadeus

+
+ Amadeuss +

Nota: 8.3 - Ano: 1984

+
+
+ +
+

Coco

+
+ Cocos +

Nota: 8.3 - Ano: 2017

+
+
+ +
+

Joker

+
+ Jokers +

Nota: 8.3 - Ano: 2019

+
+
+ +
+

Toy Story

+
+ Toy Storys +

Nota: 8.3 - Ano: 1995

+
+
+ +
+

Braveheart

+
+ Bravehearts +

Nota: 8.3 - Ano: 1995

+
+
+ +
+

The Boat

+
+ The Boats +

Nota: 8.3 - Ano: 1981

+
+
+ +
+

Avengers: Endgame

+
+ Avengers: Endgames +

Nota: 8.3 - Ano: 2019

+
+
+ +
+

Princess Mononoke

+
+ Princess Mononokes +

Nota: 8.3 - Ano: 1997

+
+
+ +
+

Once Upon a Time in America

+
+ Once Upon a Time in Americas +

Nota: 8.3 - Ano: 1984

+
+
+ +
+

Good Will Hunting

+
+ Good Will Huntings +

Nota: 8.3 - Ano: 1997

+
+
+ +
+

Your Name.

+
+ Your Name.s +

Nota: 8.3 - Ano: 2016

+
+
+ +
+

Requiem for a Dream

+
+ Requiem for a Dreams +

Nota: 8.3 - Ano: 2000

+
+
+ +
+

Singin' in the Rain

+
+ Singin' in the Rains +

Nota: 8.3 - Ano: 1952

+
+
+ +
+

3 Idiots

+
+ 3 Idiotss +

Nota: 8.3 - Ano: 2009

+
+
+ +
+

Toy Story 3

+
+ Toy Story 3s +

Nota: 8.3 - Ano: 2010

+
+
+ +
+

High and Low

+
+ High and Lows +

Nota: 8.3 - Ano: 1963

+
+
+ +
+

Star Wars: Episode VI - Return of the Jedi

+
+ Star Wars: Episode VI - Return of the Jedis +

Nota: 8.3 - Ano: 1983

+
+
+ +
+

Capernaum

+
+ Capernaums +

Nota: 8.3 - Ano: 2018

+
+
+ +
+

Eternal Sunshine of the Spotless Mind

+
+ Eternal Sunshine of the Spotless Minds +

Nota: 8.3 - Ano: 2004

+
+
+ +
+

2001: A Space Odyssey

+
+ 2001: A Space Odysseys +

Nota: 8.3 - Ano: 1968

+
+
+ +
+

Reservoir Dogs

+
+ Reservoir Dogss +

Nota: 8.3 - Ano: 1992

+
+
+ +
+

The Hunt

+
+ The Hunts +

Nota: 8.3 - Ano: 2012

+
+
+ +
+

Top Gun: Maverick

+
+ Top Gun: Mavericks +

Nota: 8.3 - Ano: 2022

+
+
+ +
+

Come and See

+
+ Come and Sees +

Nota: 8.3 - Ano: 1985

+
+
+ +
+

Citizen Kane

+
+ Citizen Kanes +

Nota: 8.3 - Ano: 1941

+
+
+ +
+

M

+
+ Ms +

Nota: 8.3 - Ano: 1931

+
+
+ +
+

Lawrence of Arabia

+
+ Lawrence of Arabias +

Nota: 8.3 - Ano: 1962

+
+
+ +
+

North by Northwest

+
+ North by Northwests +

Nota: 8.2 - Ano: 1959

+
+
+ +
+

Vertigo

+
+ Vertigos +

Nota: 8.2 - Ano: 1958

+
+
+ +
+

Amélie

+
+ Amélies +

Nota: 8.2 - Ano: 2001

+
+
+ +
+

The Apartment

+
+ The Apartments +

Nota: 8.2 - Ano: 1960

+
+
+ +
+

A Clockwork Orange

+
+ A Clockwork Oranges +

Nota: 8.2 - Ano: 1971

+
+
+ +
+

Ikiru

+
+ Ikirus +

Nota: 8.2 - Ano: 1952

+
+
+ +
+

Double Indemnity

+
+ Double Indemnitys +

Nota: 8.2 - Ano: 1944

+
+
+ +
+

Full Metal Jacket

+
+ Full Metal Jackets +

Nota: 8.2 - Ano: 1987

+
+
+ +
+

Hamilton

+
+ Hamiltons +

Nota: 8.2 - Ano: 2020

+
+
+ +
+

Scarface

+
+ Scarfaces +

Nota: 8.2 - Ano: 1983

+
+
+ +
+

To Kill a Mockingbird

+
+ To Kill a Mockingbirds +

Nota: 8.2 - Ano: 1962

+
+
+ +
+

Incendies

+
+ Incendiess +

Nota: 8.2 - Ano: 2010

+
+
+ +
+

The Sting

+
+ The Stings +

Nota: 8.2 - Ano: 1973

+
+
+ +
+

Heat

+
+ Heats +

Nota: 8.2 - Ano: 1995

+
+
+ +
+

Up

+
+ Ups +

Nota: 8.2 - Ano: 2009

+
+
+ +
+

A Separation

+
+ A Separations +

Nota: 8.2 - Ano: 2011

+
+
+ +
+

Taxi Driver

+
+ Taxi Drivers +

Nota: 8.2 - Ano: 1976

+
+
+ +
+

Metropolis

+
+ Metropoliss +

Nota: 8.2 - Ano: 1927

+
+
+ +
+

L.A. Confidential

+
+ L.A. Confidentials +

Nota: 8.2 - Ano: 1997

+
+
+ +
+

Die Hard

+
+ Die Hards +

Nota: 8.2 - Ano: 1988

+
+
+ +
+

Snatch

+
+ Snatchs +

Nota: 8.2 - Ano: 2000

+
+
+ +
+

Indiana Jones and the Last Crusade

+
+ Indiana Jones and the Last Crusades +

Nota: 8.2 - Ano: 1989

+
+
+ +
+

Bicycle Thieves

+
+ Bicycle Thievess +

Nota: 8.2 - Ano: 1948

+
+
+ +
+

Like Stars on Earth

+
+ Like Stars on Earths +

Nota: 8.2 - Ano: 2007

+
+
+ +
+

1917

+
+ 1917s +

Nota: 8.2 - Ano: 2019

+
+
+ +
+

Downfall

+
+ Downfalls +

Nota: 8.2 - Ano: 2004

+
+
+ +
+

For a Few Dollars More

+
+ For a Few Dollars Mores +

Nota: 8.2 - Ano: 1965

+
+
+ +
+

Dangal

+
+ Dangals +

Nota: 8.2 - Ano: 2016

+
+
+ +
+

Batman Begins

+
+ Batman Beginss +

Nota: 8.2 - Ano: 2005

+
+
+ +
+

The Kid

+
+ The Kids +

Nota: 8.2 - Ano: 1921

+
+
+ +
+

Some Like It Hot

+
+ Some Like It Hots +

Nota: 8.2 - Ano: 1959

+
+
+ +
+

The Father

+
+ The Fathers +

Nota: 8.2 - Ano: 2020

+
+
+ +
+

All About Eve

+
+ All About Eves +

Nota: 8.2 - Ano: 1950

+
+
+ +
+

Green Book

+
+ Green Books +

Nota: 8.2 - Ano: 2018

+
+
+ +
+

The Wolf of Wall Street

+
+ The Wolf of Wall Streets +

Nota: 8.2 - Ano: 2013

+
+
+ +
+

Judgment at Nuremberg

+
+ Judgment at Nurembergs +

Nota: 8.2 - Ano: 1961

+
+
+ +
+

Casino

+
+ Casinos +

Nota: 8.2 - Ano: 1995

+
+
+ +
+

Ran

+
+ Rans +

Nota: 8.2 - Ano: 1985

+
+
+ +
+

Pan's Labyrinth

+
+ Pan's Labyrinths +

Nota: 8.2 - Ano: 2006

+
+
+ +
+

Unforgiven

+
+ Unforgivens +

Nota: 8.2 - Ano: 1992

+
+
+ +
+

The Truman Show

+
+ The Truman Shows +

Nota: 8.2 - Ano: 1998

+
+
+ +
+

There Will Be Blood

+
+ There Will Be Bloods +

Nota: 8.2 - Ano: 2007

+
+
+ +
+

The Sixth Sense

+
+ The Sixth Senses +

Nota: 8.2 - Ano: 1999

+
+
+ +
+

A Beautiful Mind

+
+ A Beautiful Minds +

Nota: 8.2 - Ano: 2001

+
+
+ +
+

Shutter Island

+
+ Shutter Islands +

Nota: 8.2 - Ano: 2010

+
+
+ +
+

Yojimbo

+
+ Yojimbos +

Nota: 8.1 - Ano: 1961

+
+
+ +
+

The Treasure of the Sierra Madre

+
+ The Treasure of the Sierra Madres +

Nota: 8.1 - Ano: 1948

+
+
+ +
+

Monty Python and the Holy Grail

+
+ Monty Python and the Holy Grails +

Nota: 8.1 - Ano: 1975

+
+
+ +
+

Jurassic Park

+
+ Jurassic Parks +

Nota: 8.1 - Ano: 1993

+
+
+ +
+

Spider-Man: No Way Home

+
+ Spider-Man: No Way Homes +

Nota: 8.1 - Ano: 2021

+
+
+ +
+

The Great Escape

+
+ The Great Escapes +

Nota: 8.1 - Ano: 1963

+
+
+ +
+

Rashomon

+
+ Rashomons +

Nota: 8.1 - Ano: 1950

+
+
+ +
+

No Country for Old Men

+
+ No Country for Old Mens +

Nota: 8.1 - Ano: 2007

+
+
+ +
+

Kill Bill: Vol. 1

+
+ Kill Bill: Vol. 1s +

Nota: 8.1 - Ano: 2003

+
+
+ +
+

The Thing

+
+ The Things +

Nota: 8.1 - Ano: 1982

+
+
+ +
+

Finding Nemo

+
+ Finding Nemos +

Nota: 8.1 - Ano: 2003

+
+
+ +
+

The Elephant Man

+
+ The Elephant Mans +

Nota: 8.1 - Ano: 1980

+
+
+ +
+

Chinatown

+
+ Chinatowns +

Nota: 8.1 - Ano: 1974

+
+
+ +
+

Raging Bull

+
+ Raging Bulls +

Nota: 8.1 - Ano: 1980

+
+
+ +
+

V for Vendetta

+
+ V for Vendettas +

Nota: 8.1 - Ano: 2005

+
+
+ +
+

Gone with the Wind

+
+ Gone with the Winds +

Nota: 8.1 - Ano: 1939

+
+
+ +
+

Inside Out

+
+ Inside Outs +

Nota: 8.1 - Ano: 2015

+
+
+ +
+

Lock, Stock and Two Smoking Barrels

+
+ Lock, Stock and Two Smoking Barrelss +

Nota: 8.1 - Ano: 1998

+
+
+ +
+

Dial M for Murder

+
+ Dial M for Murders +

Nota: 8.1 - Ano: 1954

+
+
+ +
+

The Secret in Their Eyes

+
+ The Secret in Their Eyess +

Nota: 8.1 - Ano: 2009

+
+
+ +
+

Howl's Moving Castle

+
+ Howl's Moving Castles +

Nota: 8.1 - Ano: 2004

+
+
+ +
+

Three Billboards Outside Ebbing, Missouri

+
+ Three Billboards Outside Ebbing, Missouris +

Nota: 8.1 - Ano: 2017

+
+
+ +
+

The Bridge on the River Kwai

+
+ The Bridge on the River Kwais +

Nota: 8.1 - Ano: 1957

+
+
+ +
+

Trainspotting

+
+ Trainspottings +

Nota: 8.1 - Ano: 1996

+
+
+ +
+

Prisoners

+
+ Prisonerss +

Nota: 8.1 - Ano: 2013

+
+
+ +
+

Warrior

+
+ Warriors +

Nota: 8.1 - Ano: 2011

+
+
+ +
+

Fargo

+
+ Fargos +

Nota: 8.1 - Ano: 1996

+
+
+ +
+

Gran Torino

+
+ Gran Torinos +

Nota: 8.1 - Ano: 2008

+
+
+ +
+

My Neighbor Totoro

+
+ My Neighbor Totoros +

Nota: 8.1 - Ano: 1988

+
+
+ +
+

Catch Me If You Can

+
+ Catch Me If You Cans +

Nota: 8.1 - Ano: 2002

+
+
+ +
+

Million Dollar Baby

+
+ Million Dollar Babys +

Nota: 8.1 - Ano: 2004

+
+
+ +
+

Children of Heaven

+
+ Children of Heavens +

Nota: 8.1 - Ano: 1997

+
+
+ +
+

Blade Runner

+
+ Blade Runners +

Nota: 8.1 - Ano: 1982

+
+
+ +
+

The Gold Rush

+
+ The Gold Rushs +

Nota: 8.1 - Ano: 1925

+
+
+ +
+

Before Sunrise

+
+ Before Sunrises +

Nota: 8.1 - Ano: 1995

+
+
+ +
+

On the Waterfront

+
+ On the Waterfronts +

Nota: 8.1 - Ano: 1954

+
+
+ +
+

12 Years a Slave

+
+ 12 Years a Slaves +

Nota: 8.1 - Ano: 2013

+
+
+ +
+

Harry Potter and the Deathly Hallows: Part 2

+
+ Harry Potter and the Deathly Hallows: Part 2s +

Nota: 8.1 - Ano: 2011

+
+
+ +
+

Klaus

+
+ Klauss +

Nota: 8.1 - Ano: 2019

+
+
+ +
+

Ben-Hur

+
+ Ben-Hurs +

Nota: 8.1 - Ano: 1959

+
+
+ +
+

Gone Girl

+
+ Gone Girls +

Nota: 8.1 - Ano: 2014

+
+
+ +
+

Wild Strawberries

+
+ Wild Strawberriess +

Nota: 8.1 - Ano: 1957

+
+
+ +
+

The General

+
+ The Generals +

Nota: 8.1 - Ano: 1926

+
+
+ +
+

The Third Man

+
+ The Third Mans +

Nota: 8.1 - Ano: 1949

+
+
+ +
+

The Grand Budapest Hotel

+
+ The Grand Budapest Hotels +

Nota: 8.1 - Ano: 2014

+
+
+ +
+

In the Name of the Father

+
+ In the Name of the Fathers +

Nota: 8.1 - Ano: 1993

+
+
+ +
+

The Deer Hunter

+
+ The Deer Hunters +

Nota: 8.1 - Ano: 1978

+
+
+ +
+

Barry Lyndon

+
+ Barry Lyndons +

Nota: 8.1 - Ano: 1975

+
+
+ +
+

The Wages of Fear

+
+ The Wages of Fears +

Nota: 8.1 - Ano: 1953

+
+
+ +
+

Hacksaw Ridge

+
+ Hacksaw Ridges +

Nota: 8.1 - Ano: 2016

+
+
+ +
+

Sherlock Jr.

+
+ Sherlock Jr.s +

Nota: 8.1 - Ano: 1924

+
+
+ +
+

Memories of Murder

+
+ Memories of Murders +

Nota: 8.1 - Ano: 2003

+
+
+ +
+

Mr. Smith Goes to Washington

+
+ Mr. Smith Goes to Washingtons +

Nota: 8.1 - Ano: 1939

+
+
+ +
+

Wild Tales

+
+ Wild Taless +

Nota: 8.1 - Ano: 2014

+
+
+ +
+

Mad Max: Fury Road

+
+ Mad Max: Fury Roads +

Nota: 8.1 - Ano: 2015

+
+
+ +
+

The Seventh Seal

+
+ The Seventh Seals +

Nota: 8.1 - Ano: 1957

+
+
+ +
+

Mary and Max

+
+ Mary and Maxs +

Nota: 8.1 - Ano: 2009

+
+
+ +
+

Room

+
+ Rooms +

Nota: 8.1 - Ano: 2015

+
+
+ +
+

How to Train Your Dragon

+
+ How to Train Your Dragons +

Nota: 8.1 - Ano: 2010

+
+
+ +
+

Monsters, Inc.

+
+ Monsters, Inc.s +

Nota: 8.1 - Ano: 2001

+
+
+ +
+

Jaws

+
+ Jawss +

Nota: 8.1 - Ano: 1975

+
+
+ +
+

The Big Lebowski

+
+ The Big Lebowskis +

Nota: 8.1 - Ano: 1998

+
+
+ +
+

Dead Poets Society

+
+ Dead Poets Societys +

Nota: 8.1 - Ano: 1989

+
+
+ +
+

Tokyo Story

+
+ Tokyo Storys +

Nota: 8.1 - Ano: 1953

+
+
+ +
+

The Passion of Joan of Arc

+
+ The Passion of Joan of Arcs +

Nota: 8.1 - Ano: 1928

+
+
+ +
+

Hotel Rwanda

+
+ Hotel Rwandas +

Nota: 8.1 - Ano: 2004

+
+
+ +
+

Ford v Ferrari

+
+ Ford v Ferraris +

Nota: 8.0 - Ano: 2019

+
+
+ +
+

Rocky

+
+ Rockys +

Nota: 8.0 - Ano: 1976

+
+
+ +
+

Platoon

+
+ Platoons +

Nota: 8.0 - Ano: 1986

+
+
+ +
+

Spotlight

+
+ Spotlights +

Nota: 8.0 - Ano: 2015

+
+
+ +
+

The Terminator

+
+ The Terminators +

Nota: 8.0 - Ano: 1984

+
+
+ +
+

Ratatouille

+
+ Ratatouilles +

Nota: 8.0 - Ano: 2007

+
+
+ +
+

Stand by Me

+
+ Stand by Mes +

Nota: 8.0 - Ano: 1986

+
+
+ +
+

Logan

+
+ Logans +

Nota: 8.0 - Ano: 2017

+
+
+ +
+

Rush

+
+ Rushs +

Nota: 8.0 - Ano: 2013

+
+
+ +
+

Network

+
+ Networks +

Nota: 8.0 - Ano: 1976

+
+
+ +
+

Pather Panchali

+
+ Pather Panchalis +

Nota: 8.0 - Ano: 1955

+
+
+ +
+

Into the Wild

+
+ Into the Wilds +

Nota: 8.0 - Ano: 2007

+
+
+ +
+

The Wizard of Oz

+
+ The Wizard of Ozs +

Nota: 8.0 - Ano: 1939

+
+
+ +
+

Before Sunset

+
+ Before Sunsets +

Nota: 8.0 - Ano: 2004

+
+
+ +
+

Groundhog Day

+
+ Groundhog Days +

Nota: 8.0 - Ano: 1993

+
+
+ +
+

The Best Years of Our Lives

+
+ The Best Years of Our Livess +

Nota: 8.0 - Ano: 1946

+
+
+ +
+

The Exorcist

+
+ The Exorcists +

Nota: 8.0 - Ano: 1973

+
+
+ +
+

To Be or Not to Be

+
+ To Be or Not to Bes +

Nota: 8.0 - Ano: 1942

+
+
+ +
+

The Incredibles

+
+ The Incredibless +

Nota: 8.0 - Ano: 2004

+
+
+ +
+

The Battle of Algiers

+
+ The Battle of Algierss +

Nota: 8.0 - Ano: 1966

+
+
+ +
+

Jai Bhim

+
+ Jai Bhims +

Nota: 8.0 - Ano: 2021

+
+
+ +
+

La haine

+
+ La haines +

Nota: 8.0 - Ano: 1995

+
+
+ +
+

Hachi: A Dog's Tale

+
+ Hachi: A Dog's Tales +

Nota: 8.0 - Ano: 2009

+
+
+ +
+

My Father and My Son

+
+ My Father and My Sons +

Nota: 8.0 - Ano: 2005

+
+
+ +
+

Pirates of the Caribbean: The Curse of the Black Pearl

+
+ Pirates of the Caribbean: The Curse of the Black Pearls +

Nota: 8.0 - Ano: 2003

+
+
+ +
+

The Grapes of Wrath

+
+ The Grapes of Wraths +

Nota: 8.0 - Ano: 1940

+
+
+ +
+

Amores Perros

+
+ Amores Perross +

Nota: 8.0 - Ano: 2000

+
+
+ +
+

Rebecca

+
+ Rebeccas +

Nota: 8.0 - Ano: 1940

+
+
+ +
+

Cool Hand Luke

+
+ Cool Hand Lukes +

Nota: 8.0 - Ano: 1967

+
+
+ +
+

The Handmaiden

+
+ The Handmaidens +

Nota: 8.0 - Ano: 2016

+
+
+ +
+

The 400 Blows

+
+ The 400 Blowss +

Nota: 8.0 - Ano: 1959

+
+
+ +
+

The Sound of Music

+
+ The Sound of Musics +

Nota: 8.0 - Ano: 1965

+
+
+ +
+

It Happened One Night

+
+ It Happened One Nights +

Nota: 8.0 - Ano: 1934

+
+
+ +
+

Persona

+
+ Personas +

Nota: 8.0 - Ano: 1966

+
+
+ +
+

Life of Brian

+
+ Life of Brians +

Nota: 8.0 - Ano: 1979

+
+
+ +
+

Dersu Uzala

+
+ Dersu Uzalas +

Nota: 8.0 - Ano: 1975

+
+
+ +
+

The Iron Giant

+
+ The Iron Giants +

Nota: 8.0 - Ano: 1999

+
+
+ +
+

The Help

+
+ The Helps +

Nota: 8.0 - Ano: 2011

+
+
+ +
+

Aladdin

+
+ Aladdins +

Nota: 8.0 - Ano: 1992

+
+
+ +
+

Gandhi

+
+ Gandhis +

Nota: 8.0 - Ano: 1982

+
+
+ +
+

Dances with Wolves

+
+ Dances with Wolvess +

Nota: 8.0 - Ano: 1990

+
+
+ +
+ + + diff --git a/src/main/resources/static/main.css b/src/main/resources/static/main.css new file mode 100644 index 0000000..5c1fe8d --- /dev/null +++ b/src/main/resources/static/main.css @@ -0,0 +1,24 @@ +body { + background-color: #111; +} + +.title { + background-color: gold; + color: #000; + margin: 0.5em auto; + font-weight: 700; + max-width: 3.5em; + text-align: center; + border-radius: 5px; +} + +.content { + display: flex; + margin: 2em; + justify-content: center; + flex-wrap: wrap; +} + +.card { + margin: 1em; +} \ No newline at end of file diff --git a/src/test/java/br/com/alura/DaysOfCodeSpring/ApplicationTests.java b/src/test/java/br/com/alura/DaysOfCodeSpring/ApplicationTests.java new file mode 100644 index 0000000..1008263 --- /dev/null +++ b/src/test/java/br/com/alura/DaysOfCodeSpring/ApplicationTests.java @@ -0,0 +1,32 @@ +package br.com.alura.DaysOfCodeSpring; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +class ApplicationTests { + + @LocalServerPort + private int port; + + @Autowired + private TestRestTemplate restTemplate; + + @Test + void deveRetornarTop250FilmesIMDB() { + String url = "http://localhost:" + port + "/api"; + ResponseEntity response = restTemplate.getForEntity(url, String.class); + assertEquals(HttpStatus.OK, response.getStatusCode()); + assertNotNull(response.getBody()); + } + +} -- cgit v1.2.3-18-g5258