part of angel_framework.http; /// An in-memory [Service]. class MemoryService extends Service { God god = new God(); Map items = {}; Future index([Map params]) async => items.values.toList(); Future read(id, [Map params]) async => items[int.parse(id)]; Future create(Map data, [Map params]) async { data['id'] = items.length; items[items.length] = god.deserializeFromMap(data, T); return items[items.length - 1]; } Future update(id, Map data, [Map params]) async { data['id'] = int.parse(id); items[int.parse(id)] = god.deserializeFromMap(data, T); return data; } Future remove(id, [Map params]) async { var item = items[int.parse(id)]; items.remove(int.parse(id)); return item; } MemoryService() : super(); }