Sysop Dev Diary, Part 3: Backend Dev
Last night I got the basics set up for developing this backend. A Linode instance, Docker, Vapor and all that set up. Today I'm focusing on getting the most basic functionality levels in place for the API. I'm typing this out as I write the code, so this is going to be very stream of consciousness as I sort all this out.
First, I need a model for a single message. I set up Vapor with Fluent support and a SQLite database, so it's straightforward. It will need to transition into a more robust database before it goes live, but Fluent should be able to just handle that. The Message needs a timestamp, content (a string for now, will need to be expanded later), a creator and a destination. Creator and destination will be an ID that references either a customer or an end user. I'm just going to call them “Users” I guess. They're all using the app anyway. Make it simple for now, just an ID. Flesh that out more later.
Okay, create the migrations for both objects. Github Copilot is surprisingly helpful in all this, I didn't think it would do well with Vapor but I'm impressed.
Built a route for creating a user and a message, threw everything into Postman, debugged and we have a message! Vapor is cool 😊.