How to connect vapor to my existing table of mysql?

I am newbie in vapor.
I have seen a lot of docs teach how to connect and create to a new table.
but any docs teach how to connect to an existing table?

thanks.

This is much easier in Vapor 4. You create a model that maps to the table in the database and you just don't create a migration. All the other Fluent queries should work as normal

i did. but it doesn't work. and how can i print it out?
I got a returned object of EventLoopFuture<Value>

I want to unwrap it to get the Value to print it out.
I believe this is something about async.
i did try using wait(), but i crashed.

thanks.

do you guys know any good thorough tutorial?

Print out what? Can you show the full code you ran and what your models look like? The Fluent query docs and other pages are the best place to look.

{"reason":"Unsupported Media Type","error":true}

i got this error.

Please show some code. It's impossible to help if you just post the error message. Like I said, can you post your model code and the code where you make a query?

1 Like