Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Low fat backends for mobile guys

Low fat backends for mobile guys

Low fat backends for mobile guys:
Develop simple backends in Java in minutes

Avatar for Alexandru Simonescu

Alexandru Simonescu

February 28, 2016
Tweet

More Decks by Alexandru Simonescu

Other Decks in Programming

Transcript

  1. mbaas cons not a golden unicorn _you depend on some

    else infrastructure _normally can be cheap, related your needs _no full control, your data is not yours _sometimes hard to scale
  2. backend cons or not :-) _custom backend is hard to

    develop _can be expensive _i can’t setup infrastructure _i’m just a mobile guy
  3. kickstart 1. set project metadata 2. choose dependencies 3. download

    4. import in favorite IDE 5. customize and run https://start.spring.io/
  4. hello world controller @Controller @RequestMapping("/status") public class StatusController { @RequestMapping(value

    = "/", method = RequestMethod.GET) @ResponseBody public String status() { return "All looks ok from here! :-)"; } }
  5. more complex controller @RestController @RequestMapping(value = "/movie") public class MovieController

    { @Autowired MovieRepository movieRepository; @RequestMapping(value = "/", method = RequestMethod.GET) public List<Movie> all() { return movieRepository.getAll(); } }
  6. persistance entity @Data @Builder @Entity public class Actor { @Id

    private Integer id; private String name; }
  7. rest data access @RepositoryRestResource(collectionResourceRel = "actor", path = "actor") public

    interface ActorRepository extends JpaRepository<Actor, Integer> { }
  8. run your backend @SpringBootApplication @Import(SecurityConfiguration.class) public class MoviecloudApplication { public

    static void main(String[] args) { SpringApplication.run(MoviecloudApplication.class, args); } }