Skip to content

Instantly share code, notes, and snippets.

@OmarElgabry
Last active February 19, 2019 08:33
Show Gist options
  • Select an option

  • Save OmarElgabry/48fdb50fcd4adda191fd984501c3e4df to your computer and use it in GitHub Desktop.

Select an option

Save OmarElgabry/48fdb50fcd4adda191fd984501c3e4df to your computer and use it in GitHub Desktop.
Eureka Image Service Controller
package com.eureka.image.controllers;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.eureka.image.entities.Image;
@RestController
@RequestMapping("/")
public class HomeController {
@Autowired
private Environment env;
@RequestMapping("/images")
public List<Image> getImages() {
List<Image> images = Arrays.asList(
new Image(1, "Treehouse of Horror V", "https://www.imdb.com/title/tt0096697/mediaviewer/rm3842005760"),
new Image(2, "The Town", "https://www.imdb.com/title/tt0096697/mediaviewer/rm3698134272"),
new Image(3, "The Last Traction Hero", "https://www.imdb.com/title/tt0096697/mediaviewer/rm1445594112"));
return images;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment