Created
March 12, 2020 00:23
-
-
Save gdonega/544eb19e82c586ce1562f45f64770994 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.testes.spring.mongodb.rest; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.http.ResponseEntity; | |
import org.springframework.web.bind.annotation.PostMapping; | |
import org.springframework.web.bind.annotation.RequestBody; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
import com.testes.spring.mongodb.models.JogoModel; | |
import com.testes.spring.mongodb.repositories.JogoRepository; | |
@RestController | |
@RequestMapping("/testes") | |
public class TesteController { | |
@Autowired | |
private JogoRepository jogoRepository; | |
@PostMapping | |
public ResponseEntity<Object> get(@RequestBody JogoModel jogoModel) { | |
JogoModel salvo = jogoRepository.save(jogoModel); | |
return ResponseEntity.ok(salvo); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment