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
| CREATE TABLE `books` ( | |
| `id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
| `title` varchar(64) DEFAULT NULL, | |
| `description` text, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
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
| CREATE DATABASE bookstore; |
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
| eyJkYXRhIjp7ImVtYWlsIjoiZHVzYW4uc3Rhbm9qZXZpYy5jc0BnbWFpbC5jb20ifX0 |
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
| eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7ImVtYWlsIjoiZHVzYW4uc3Rhbm9qZXZpYy5jc0BnbWFpbC5jb20ifX0.fcsKMrL5Vvo5ejV4wVrVLiBhnzqioX0iLrr8Ya7D6Rc |
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
| { | |
| "data": { | |
| "email": "[email protected]" | |
| } | |
| } |
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
| /*jshint unused:false*/ | |
| import DS from 'ember-data'; | |
| export default DS.RESTAdapter.extend({ | |
| try: 0, | |
| findAll(modelName, query, params, modelClass) { | |
| // we return different records | |
| this.set("try", this.get("try") + 3); | |
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
| # Routes | |
| # This file defines all application routes (Higher priority routes first) | |
| # ~~~~ | |
| GET /books controllers.BookController.findAll() | |
| GET /books/:id controllers.BookController.findById(id: Integer) | |
| POST /books/:id controllers.BookController.create() | |
| PUT /books/:id controllers.BookController.update(id: Integer) | |
| DELETE /books/:id controllers.BookController.delete(id: Integer) |
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 controllers; | |
| import com.google.inject.Inject; | |
| import play.libs.Json; | |
| import play.mvc.Controller; | |
| import play.mvc.Result; | |
| public class BookController extends Controller { | |
| @Inject |
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 repositories; | |
| import com.google.inject.Singleton; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.Optional; | |
| import java.util.stream.Collectors; | |
| @Singleton |
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 models; | |
| public class Book { | |
| private int id; | |
| private String title, description; | |
| public int getId() { | |
| return id; | |
| } |