Skip to content

Instantly share code, notes, and snippets.

@graphicbeacon
Created May 16, 2018 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graphicbeacon/6eb6d79a347063d5ad88df9f9e789223 to your computer and use it in GitHub Desktop.
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)
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