vapor / fluent

Vapor ORM (queries, models, and relations) for NoSQL and SQL databases
https://docs.vapor.codes/4.0/fluent/overview/
MIT License
1.32k stars 172 forks source link

Adds Response.created methods #665

Closed grosch closed 4 years ago

grosch commented 4 years ago

Provides convenience methods for returning newly created objects. Sets the status code to 201 (Created) and includes the Location header.

func create(req: Request) throws -> EventLoopFuture<Response> {
    let todo = try req.content.decode(Todo.self)
    return todo.create(on: req.db).flatMapThrowing {
        try .created(todo, for: req)
    }
}
grosch commented 4 years ago

Hold off on this...I'm making some other changes here.

grosch commented 4 years ago

Resubmitting a new request