Created
May 16, 2018 22:29
-
-
Save graphicbeacon/6eb6d79a347063d5ad88df9f9e789223 to your computer and use it in GitHub Desktop.
Sample code for "Building RESTful Web APIs with Dart, Aqueduct and PostgreSQL (Part 2)" post on Medium (6)
This file contains 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
import '../fave_reads.dart'; | |
class Book extends HTTPSerializable { | |
String title; | |
String author; | |
int year; | |
Book({this.title, this.author, this.year}); | |
@override | |
Map<String, dynamic> asMap() => { | |
"title": title, | |
"author": author, | |
"year": year, | |
}; | |
@override | |
void readFromMap(Map requestBody) { | |
title = requestBody["title"]; | |
author = requestBody["author"]; | |
year = requestBody["year"]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment