stablekernel / aqueduct

Dart HTTP server framework for building REST APIs. Includes PostgreSQL ORM and OAuth2 provider.
https://aqueduct.io
BSD 2-Clause "Simplified" License
2.41k stars 279 forks source link

Create Model without create table , just for @Bind.body() #933

Closed Issam-Otoz closed 3 years ago

Issam-Otoz commented 3 years ago

Hello friends first of all , Thank you for aqueduct I want to create model only for Bind method how can I do that

Issam-Otoz commented 3 years ago

this is the solution : class Person extends Serializable { String name; String email;

Map<String, dynamic> asMap() { return { "name": name, "email": email }; }

void readFromMap(Map<String, dynamic> inputMap) { name = inputMap['name']; email = inputMap['email']; } }

final person = Person(); final response = Response.ok(person);