Categories
Online Marketing

Golang UK Conference 2017 | Mark Bates – Buffalo: Rapid Web Development in Go

I almost didn’t make it as well sad but true so yeah. My name is Marc Bates, where you’re here to talk about rapid web development with go. I won’t be nearly as funny as Matt and at look at their leaving already. Oh, I can completely understand if anybody else didn’t know this was me you can absolutely leave my god, and I was just about to compliment you.

These are my friends. According to my mother’s paychecks, so those of you who saw and saw their talk just a few minutes ago know that this is actually how I look in real life, but this is how I look as a gofer that is my custom. Ashley McNamara gopher down there in the corner. What I love, what this is, nobody else has this gopher. It is impossible that guitar is unique to me, the hair, the shirt everything else you got to go for eyes me that’s mine, so Who am I for those of you who don’t know which I assume is almost everybody, except for the people in the front row Here and you I said, my name is Marc Bates.

You can find me on the Twitter’s, the github slack as Marc Bates, I run a company called gopher guides which does customizable training. So if you have training needs come find us, I also run go Buffalo do, which is what we’re going to talk about today, we’re going to talk about the wat in the. Why and the what I say and the Buffalo oh and demo. But what do I in the demo? This is an interesting project and I think this project has we can have a real impact on the NGO community, a really positive impact, I think – and I’m not just blowing smoke, because I’m amazing and actually made this beautiful logo here I should talked about.

So. Let’s talk about web development ago and why I think Buffalo is what we need to not only be able to do better, make faster websites or make websites faster, but also to grow the community to make the community stronger and better. Who has heard this phrase before right? Literally everybody? I see this on Reddit and Twitter and slack like I’m looking to build a web app. What do I do just use a standard library which is, I think, just awful advice.

That’s the equivalent of saying RTFM, all right, just go use the standard library. How do you not know this, but I’ve never written go before, but it’s in the standard library and by the way, the standard library is amazing and one of the best standard libraries we have I’ve ever seen. So I’m not downplaying the standard library, but talking about the the way that new people come to go and what they see and what their first reactions to the go community are and unfortunately, a lot of people’s first reactions.

It’s is this very elitist kind of we’re better than you. We don’t need your stinking frameworks. We don’t need your rails, your symphony, your Django or whatever right. We roll our own who’s heard that phrase before just roll your uh that’s fun, because I want to ship an app this weekend, I’ll just roll my own rails, that’s got ta, be easy. The standard library is essentially a collection of building blocks.

That’s really what’s been, for, I think Steve said the other day. It’s meant for library, authors not really for end-users right, like it’s meant for the people in this room to build really cool packages, so that those new people coming in could do something even simpler and even more amazing. This by the way, is the world’s largest Lego sculpture ever made. It is a life-size life-size, as if they really exist, x-wing fighter, if it’s in California – and if you ever see the movie brick you’re, the brick you mentoree on Lego, who’s.

Seen that nobody – oh my god, it’s amazing, they talked about the building of this thing and how they shipped it and manufactured it and construction. It’s awesome, and this is me and my oldest son a few years ago. He was very excited not as excited as me, but he was kind of excited. I really had to pay him to do that. So look every language getting back to standard library. Language has a standard library.

Some are better than others and go is definitely one of the best, but why would you want to build a web app using justice, standard library? Let’s take Ruby, for example, right ruby has a staring library: ruby has web app stuff in the standard library. Does anybody here every built a web app using just the Ruby standard library I didn’t think so? Has anybody here built a web app using just the Java standard library, the dotnet standard library, no see you kind of see where I’m going with this? We are like the only language who touts this way of building complex web applications, just use the standard library it’s great, it really is, but why would you want to do that? Why would you want to sit there and spend all that time rolling your own? There are reasons I’m not going to say there aren’t reasons.

There are plenty of reasons to just use a standard library. You know Matt talked earlier about building gopher eyes me in five hours. It’s got how many endpoints to two or three yeah right. It’s a tiny little app right, you don’t need yeah, you don’t need a rails to build gopher ëismí, but you know what you do need something like that for its to build a giant web application, a business. You can’t roll your own and get that to market anytime soon, and for me, it’s all about getting to market.

I need to get to market. You need to get to market because that’s how our businesses are built. Web apps are not simple, don’t let anybody tell you they are here are a few things that almost every web application needs, and I’m not talking ago, fries me that to end point thing: I’m talking you know you’re going to build the next big thing. Hopefully, right you’re going to build a business, you need all of these things and they don’t all exist in the standard library they’re, not there.

Some of these things are, but not all of them. So now I want you to imagine just for a second. You knew who is new to go. Oh wow, okay, fantastic! So you don’t have to imagine the rest of you pretend you’re them and do a little mental exercise. You’re new to go – and you say I this new startup idea and I’m going to crank it out. This weekend, because that’s what I’m used to doing in some other languages, I can roll a django app and weekend or rails the symphony app.

What have you so I’m going to roll it and go because I hear go? Is the next big thing I’m going to create a ride chair because, as we found out yesterday from Steve, you cannot create a ride-sharing app that without using go. So that’s we’re going to do so. I say: okay, I know I got to do all these things. So let me start looking through the standard library right, okay, well router. I found those to serve mocks fantastic, so I got a little hello world going where we’re rocking.

Now I want to do a post requests. Can’t really do that. I can put a case statement in there that that seems good or an if I’ll start with an. If maybe and then very quickly, you’re like I need a third-party router, I’m going to have to pull in gorilla, mocks or HTTP router, and now I’m on reddit saying: does anybody know of a good road or I can use the serve MUX? Doesn’t do it? For me, and they respond with just use the standard library and then somebody yells, the other person flips their finger off, but it becomes a whole international incident yeah so anyways, oh, my god, okay, fine, okay, I’ll use it I’ll use gorilla mocks, I’m in third priority.

Now I’m going to get to templating and you start using the attempting library and you’re like oh. I really need to do a slightly complex if statement in my liya, I can’t do that. I can’t I what, if I want to pass a function into another function like a nice little help. Oh, I can’t do that. Does anybody know of a good template package and all of a sudden, like you start going down this list and you realize, like the standard library, is good, but it is not going to get you this app out in a weekend, and I have talked to a Lot of brand-new developers and those of you new to go who’s tried to write a web app using standard library, something fairly complex.

Yeah tell me if any of these words sound familiar to you, scary, daunting, unwelcoming. That’s the problem! We’re having you don’t see that Steve Steve’s going maybe Ashley says yes unwelcoming. This is how I fell. I felt like that when I first came well, I know put the peanut gallery in the front rounds. I did I didn’t know. I did not invite you. I specifically said you should goes to the other top read mine on article later.

The problem I’ve found is I’ve talked about people. This is the way they felt and then they’re gone. They don’t come back, they pull of Kaiser, so say hey just if you don’t understand that reference. You are missing a an amazing movie, absolutely amazing movie and I’ve just ruined the ending. Don’t point your read again now, but if you ever see it try to forget this, so I had a lot of people. I’ve been doing go now for for almost five years now, and during that time I’ve shown up at a lot of usually a lot of Ruby me.

That’s telling everybody use go which, by the way is really mean. Don’t do that like don’t go to other people’s meetups and tell them that they’re doing it wrong. I do that. That’s my job. If you start doing that, I’m out of business, that’s their good, but I’d show up and these people would say. Okay, mark, you love go. What do you used to build web apps? I said: well, you just use rails and I’m like well, that seems counterintuitive to your statement of go is amazing and it is but this was me honestly up until this year and then this happened Buffalo the the question is where’s, the logo came first or not.

It did now so yeah. Well, let’s talk about Buffalo buffalo is an ecosystem for rapid web development. Is it a framework? You might say that I won’t, because the framework is where it is taboo in our industry, for some reason, or at least this community. The word framework is like a kiss of death for some reason I was talking to Steve again about this is, and I did Steve wrote Cobra who uses Cobra right.

It’s excellent, it’s excellent, but you know what it is. It’s a framework and Steve said that when he first published Cobra was like. Why would you need this framework just to use the standard library? We have the flags package it’s like well. Have you ever tried to build complicated, CLI tool using just a standard library kind of hard not going to lie to you so Buffalo I like to considered an ecosystem cuz? It’s not just about the Buffalo package matter of fact.

The Buffalo package itself is not overly big and that’s important to remember what it is is glue around the best parts of go and the best parts of what the community has had to offer for go. We take the stance of we’d, rather not have to write it ourselves. We want to use the gorilla Lux rudder, that is battle tested and everybody loves right. I don’t want to ride a router. You don’t want me to write a router.

I can’t even say write a router well, I said at that time. Maybe I can build a router who knows um Buffalo takes all this stuff and just kind of gives it to you. We found the best packages and I’ll talk about some of them in a minute to do all these things for you, so that you can roll an app out in a weekend and those people coming to go for the first time can have that positive experience. That welcoming experience that they had the first time they went through rails, for example, I remember going from Java to rails back in 2005, actually fun fact I quit Java in 2003.

I quit development. I rage quit development after writing, a hundred thousand lines of XML and it’s not a joke 100,000 lines of XML. I rage quit and worked in a recording studio for two years. That was and then I was out and then someone introduced me to rails and it was magical. It was like. Oh look, how welcoming this is like. I can get something out fast and that’s what I want. I want to just start coding.

I don’t want to spend time figuring out all these pieces right as a consultant as a business owner as a human being, I need to just get to market. I just want to get my stuff out there. I don’t want to spend weeks rolling my own custom. Router or my own templating system, or figuring out my how to run migrations against my database, I want somebody to figure that all out for me somehow I became that person which is kind of terrible.

This is an important slide and one I really want to drive home when we talk about Buffalo buffalo is extracted, it is not imagined, and that is important whenever you’re talking to anybody about their new framework, their new library, their new tool, if they imagine, if they Sat down one day and said you know it would be nice, a package, a library or framework to do X, Y & Z, don’t use it because it hasn’t been used.

It hasn’t been tested, someone, yes, who was it? Was it Matt? Was it you yesterday who said like um just hold on to it like don’t release anything publicly like play with it? Learn it right and then you can release it publicly and that’s what happened with Buffalo buffalo is years old in a lot of ways, and I spent a year working for a company building an enterprise application for them that needed to be installed on-site.

They needed they didn’t know what the database was going to be, so they needed support from MySQL PostgreSQL light. They need to feel a ship, a binary, no other files, no templating files, no JavaScript files, a single binary. They need to be able to send it to them and say here here a couple commands and that binary run them and that’s where buffalo really took shape and then in December of last year I was talking with Brian Kedleston and I can’t remember how the conversation Came up, I said I’ll.

Let me show you something and I showed him Buffalo he’s like. Oh my god, you absolutely have to open-source that you need to publish that and then he scheduled me on go time like for two weeks later he could get two weeks. Yeah, two weeks to bang this thing into shape and that’s true and his that up did anybody. Has anybody heard my go time episode couple people yeah you you more of you should because it is the highest-rated go time episode.

It is, and it’s live from a Dunkin Donuts which which has a story to it, but anyway buffalo has two goals and the first one is incredibly selfish. I’r not going to lie to you. It’s let me write applications as fast as I can I rails. That is a hundred percent. The first goal I consider myself to be the primary user of Buffalo. Actually I consider Brian cattle son to be the primary user. Buffalo is rather you push more production.

Buffalo helps, and I have you write one a week. I think at this point yeah, but for me that was the original impetus right. I wan na be able to write apps as fast like Hannah rails, the other ones bit more altruistic. I want to make go more accessible and I think the web is the best place to do that, and why do I think that I think? Well, I know there are more web developers in the world than anybody else.

Well, not anybody else. There’s a lot of Chinese people, probably more of them than been web developers, I’m almost positive that I’ll check later, but now there are more web developers than any other type of developers. This probably a better qualification and that’s a big world. We’ve got between 500 and $ 100,000 and the other day on Twitter said I was just about to give up on golang, and then I found Buffalo and it’s almost like a conspiracy to make rails or as Gophers.

I was like no, it’s a conspiracy. If that’s absolutely the point, we want to get more people and go because I want a bigger community. I want conferences like this to thrive and we’re seeing this we’re seeing more and more conferences every single year, which is awesome, but we can make this thing go through the roof and what do we get with a bigger community apart from more information and more diversity? And better libraries of better packages, we get more jobs who here writes, go full-time for their current job, not enough people right, not enough people, and you know why? Because we need more go developers.

If you have more go developers, companies will take more of a risk on go and it’s not really risk. As we know, go is amazing. You’re not here to be sold on, go you’re already paid your ticket or you stumbled in off the street Ernesto, but yeah companies will be take more of a chance and they’ll say: ok, look! Look at all these developers out there and they’re all doing these amazing things. We should start doing that in-house, so more jobs, bigger community means, more jobs means less, not writing go and that’s awesome.

I am down to one rails, app, one ruby app. I have to maintain, unfortunately, no I’d love to. I love the app, but I want to write it in Buffalo, but it’s three years old. I can’t but I’m down to that and that’s an awesome feeling to not have to deal with Ruby anymore, nothing against Ruby, but I really love go so really what better way to grow go. I think, then, through the web. So with that said enough evangelizing, why? I think Buffalo is important to the community.

Hopefully you feel the same way. Hopefully you you can see that as a community. We can take this project and it’s not my project. We’ve got a lot of great contributors and I want to see more contributors, but we can take this thing and we can make it big and we can grow this community in a way. That’s you know, we’ve only just kind of touched the surface on. So that’s the: why of Buffalo? If you will, let’s talk about the what it’s probably what some of you were here to see, but what a buffalo Buffalo is a batteries included framework and we’ve heard this phrase before but when I say batteries included, I actually mean all of the batteries, not just The go batteries and that’s an important part of what Buffalo does here are some of the included batteries, for example, gorilla mocks for routing plush for templating pop for database web pack and yarn for our asset pipeline deployment.

We’ve got things like docker and Buffalo, build which we’ll talk about testing we got go. We got some testify in their task scripting. If you ever used like a rake in Ruby before we got an amazing system called grift which lets you use the phrase I grana grift today, no ok, so I named things based on puns, never mind: okay, internationalization sessions, the whole nine yards. If you don’t like the included batteries, that’s fine just use your own there’s only one included battery.

That is absolutely required. That’s the gorilla mocks router, but if you get down so that’s the only one you absolutely have to use, but if you don’t like your own use, the other one you get rid of them. A lot of these have flags, so just turn them off. You don’t want webpack turn it off. You don’t want docker turn it off. You don’t want plush or templating and use the API flag and boom you’re just dealing with JSON stuff right.

There’s lots of lots of customization here we are not forcing you to use anything except for gorilla mocks, but with that said understand that if you change that some of these pieces, some of the built-in generators may not work for you, as I kind of have expectations Of what you’re expecting to do, but, for example – and I don’t expect you to read this code – you can replace the templating engine by implementing the template engine type.

Just one function takes three arguments. You can create your own renderers, it’s one func, it’s a interface with two functions, very simple functions, and so on and so forth. Let’s talk about development. What’s the development time like for me, buffalo is all about developer productivity. That is the number one metric I base. Buffalo on how easy can I build my app? How fast can I build my app? I go into an argument with somebody on github the other day because they wanted benchmarks on like the router and stuff with my kid, so the gorilla mocks Rodrigo look at their benchmarks and you’re like but we’ve.

What are you two hiding on top of like? Does it matter you get two millisecond response times it doesn’t matter, it’s fast enough for you. For me, the development speed is the benchmark that matters and we’ll do this. I’r actually going to build an app and we’ll deploy it to Heroku. By the end of this talk here, we offer a ton of commands. Buffalo is not just a package, it is a tool chain and that’s why I say it’s an ecosystem.

The buffalo binary has so many sub commands, and so many sub commands off those sub commands. So do insane things now we have plugins where you can write your own sub commands for Buffalo and plug them in and we’ll see that with my Heroku one later, but the Buffalo dev command compiles starts the application for you, reades any assets and rebuilds them. If you’re using webpack, so as you change your style sheets and JavaScript and by the way its default configuration is es6 and s CSS and jQuery, and all that stuff is kind of ready out of the box.

We do production, minification, ugly, fiying and stuff like that. For you static assets to serve from disks, there’s no recompiling of go file like you know, if you’re using like bin data before we have to keep compiling every time, we make a change to something we don’t have to do that they’re all served from disk. So later, if you’re go files change, we read them, we recompile the application and restart it for you, so the by the time you hit save and vim, and you tab back over to your browser, your apps already restarted.

You can refresh the page and area changes. We even show you a web page if there was an error compiled in your binary and tell you what the error is. We go out of our way to make the developer experience amazing for you deployments. This is another key thing we want to be able to deploy our apps quickly and fast. One of my favorite ways is docker and if you generate a new Buffalo app, for example, you get a file that looks like this.

It’s a multi-stage docker file and that’s all you need to compile and deploy your application or you can use the buffalo build command, which is kind of cool too again builds assets for production if you’re using webpack bundles your templates, your assets, your migrations, anything else, any Other static content you might have into the binary all there in one command, auto versions, the binary installs, the SHA and the build time into the binary as well.

So we can query the binary. We can run migrations off the binary. We can serve the app off the binary, that’s kind of an important one. It supports all to go tags, LD, Flags, environment variables. Everything like that entire tool chain is one binary to rule them all now, whatever you know, I don’t want to be here either you just tell the organizers. We had a talk and enough. Okay, let’s do a little demo shall we so for our demo we’re going to bring up someone from EA to demo their really boring game for the next ten minutes.

I really hate those Apple demos, they’re, the worst they’re, so bad, oh, my things over there. Okay, am I close to it here we go and there’s my mouse. Oh, like I saw something. Computers are hard. There you go there, we go where’s the mirroring option. Anybody see it Oh arrangement. Thank you. Yeah there we go. Okay, fabulous! So, let’s start a new application here, so petals’ ins name just popped up, bigger, how’s that okay, so there you it’s the buffalo new command, all apps start with a buffalo new and you can see.

We’ve got a ton of flags here to skip yarn, skip webpack skip pop docker. You can do non multi standard database type, Postgres, MySQL, sequel, Lite. You can skip that entirely. You can do just the API, which makes it just aged like JSON API and gets rid of all templating and fun stuff, like that. I don’t know why you would, but you could, but let’s create a new Buffalo app here called golang UK. That sounds good here.

We go, this is going to go, get a few things, go import step. Oh, we have a console in Buffalo, so you knew Buffalo console and get in there, and you can talk to your models and stuff like that which is kind of fun, and the console is getting a big rewrite as well. We’re not going to keep using gore. We’re going to we’ve got a big rewrite in the works, so now I’m going to installed a bunch of front-end packages.

Here there we go. I’ve created my whole application. I’ve created a ton of files, I’ve actually done a get in it and if I go into the application here, was it golang UK not go lonk there we go, I can’t type standing up why they make people type soon. You know this is what your default Buffalo application looks like hard to read in the back, but you shouldn’t sat in the back plenty of space up front.

I don’t know why you’d be back there. Yeah we’ve got a couple dot files here, but we’ve got actions as well. All our handlers are going to go. This is how we’re going to handle all of our requests. Our assets is where our style sheets are Java. Scripts, are s CSS our images, whatever we want going to go in there are grips. These are these little tasks. We get to run here, locales for internationalization models for our database stuff, node modules cuz its node.

I don’t know what they did they put stuff in there, don’t look. It’s scary public folders of all your assets gets compiled and then templates, that’s where all of our templates should go so first thing I like to do well. The first thing I usually do well, I don’t do because I’m awesome he’s configure my database yeah Mel file to talk to my database, make sure that’s it’s set up correctly. So if we look at that here, for me this is 100 % set up correctly.

Surprise. It works fine on my machine, but yeah you can figure your username, your password, your hosts, all that sort of stuff and once you’ve done that you can run the nice DB, create all command they rego. I’ve created my production, development and test databases all created. For me, I could start my application here. There we go. It started on port 3000 and if I go to port 3000, my assets have compiled there.

We go whoo, a buffalo, fantastic, be pretty boring. If that was it, that wouldn’t it be, but this is kind of interesting. I love this feature. This is just the homepage, but we can show this on. The console. I’ll actually show it on a console. Looks I think it’s cooler there Buffalo tasks routes. Here we go here’s a list of all of our routes: method, get’ slash! There are no aliases for this route, the helper name that you can use in your templates there’s route path, and this is the handler that tack actually handling that which is kind of cool.

So I can just very simply look and say who is handling that particular thing, and it gives me the actual like full path, name to it, which you won’t see in a lot of other places. Okay, so we’ve got an app running here, but that’s not that interesting. Let’s actually do something here: let’s uh do some database stuff shall we yeah? I love. I love your enthusiasm. You like yes mark. Let’s create a new resource and we’ll call this widget and widget.

Will have a name and it’ll have a body which is of type text. If I run that there we go, I’ve created a whole bunch of code. I’ve created actions, an entire set of crud actions to handle my resource. I’ve said it created a whole entire set of templates to handle my resource. I have also created models to handle my resource. I have created migrations to handle my resource, and now I can run Buffalo DB migrate.

There we go. I’ve created my database, it’s my table in my database and we if we go back here and restart there, we go starts up everything here. I go back. Ok now I have a whole bunch of widgets stuff in my routing table. If you don’t believe me that that actually exists and we’ll look at some of this code in a second here here we go: here’s my widgets and I create a new widget and if I hit save ooh, I think a validation errors, fancy fancy pants hello world, Nice to see you yeah, I could save it.

Wow a database backs widget fantastic. Did that in about what 10 seconds, not even which is pretty cool. We also it’s a nice log output here, but let’s actually look at some of this code. What actually happened there? Most of the stuff that you’re interested in is going to be in actions. Your actions folder and here is the actions app folder the actions app. This is where most of your life lives in a buffalo application.

You create a new buffalo application. Give it a few configurations by default. We have two different types of buffalo applications, automatic and standard, never use standard, it’s a stripped down version of automatic and I don’t know why you would use it, but we have it just because we had some middleware like the session saver. So we automatically save your sessions, so you don’t have to keep doing it in your code.

Anymore, parameter logging, CSRF, middleware kind of all set up for us. I like to wrap all my requests in a translate database transaction. You don’t have to internationalization handler asset Handler and then finally, our widgets resource right down here at the bottom. So all that was generated for us by Buffalo by their generator commands. But you own this code and that’s important to understand this, isn’t like Goa or something like that where you have to keep continually regenerating stuff once you Genet, that’s it we’re kind of like here is the base for you to work with this.

Is your application? Not ours do what you need to and if we look at the widgets like spell widgets, we just go here we go. This is the action. This is the resource that we generated. So you can see here’s some nice list information. So we go. We get all the list we have pagination set up for you by defaults, so we can paginate all your widgets, but you go in here and you change this and you do this.

You build your business logic, we’re just trying to get you started. We want you to have that beautiful, win. Remember we want you to start getting too busy getting to your business logic as fast as possible and giving you as much information as we can to do that and you can go through and you could see all the other fun stuff that’s happening in there and We have a widget model somewhere. If I can type here, we go.

Here’s my widget model that was generated. You, you IDs, you can use int, but I recommend you, you IDs, I think, they’re better. For a lot of reasons. We’ve got Auto, manage, created and updated. Apps, for you, here’s our name, there’s our body, some nice string stuff, a collection type. We even try to start adding validations for you based off what you typed in that command line, because you said that you wanted what a title and a bar name and a body – and you didn’t say there were no lights, so we say: okay well, they obviously Have to be present, that’s where those validation errors came from and then you could go down.

There’s different validations for different action. Types like if you’ve saved it if you’ve updated it that sort of thing, and now, let’s look at templates new here’s our new page for our template, with this lovely form for helper here for anybody familiar with rails. This is the plush templating library by the way hands down the most powerful templating system. Brian’s going. Oh yeah, no other go templating system.

Is this powerful and I really truly saying that not just because I wrote it, but that’s part of it hey. It was named after an awesome song from the 90s what STP series are formed for for a widget, and it goes to the widgets path and it’s a method, type post and we’ve got a partial support here. If we look at the form for it, there we go, we got nice things like input, tags and text areas and all sorts of stuff, and this handles all of our CSRF.

All of our error handling, if we go back to say edit a widget and we inspect the HD. Let’s not do that. Let’s do a view source. That’s the thing view source the people still view source, maybe not know. I click on the page. Now see. Look! It’s oh show page source, not view page source. Oh, it’s still the same. Damn inspector, I was lame. There we go and go away. There we go and there we go. That’s what I was looking for.

Just give you an idea of the generated form. You see. It’s got IDs and methods and authenticity token there, which is our CSRF token, someone. I think it goes off the screen and all that sort of stuff there yeah. So this is all built-in. This was all free for you to just go and use and do with. As you please, but this isn’t enough wait how much? How are we doing for time? We’ve got ten minutes, someone know Tam.

Thank you. I’r just going to keep doing this till someone responds because this apparently means show me the time I know sign language. That’s not true at all, let’s uh, let’s actually deploy. I clearly don’t know anything about sign language. Let’s deploy this app and then we’ll do some more fun stuff with it. Hopefully, if we still at some time here so I am going to use the buffalo Heroku plug-in.

I know and have you used this yet now and if I do buffalo Heroku set up here, we go it’s going to start, creating a buffalo, app or app. For me, set the go canned: go ian vida production set a session secret for me, it’s creating a database for me Saturday up SendGrid for me, because, typically, when I set up an app, I want all the bells and whistles Redis and that sort of stuff. I could have skipped some of this stuff, but anyway they said this is an unofficial plugin.

This is a plugin by the way, but I don’t want to sit here and type all the stuff out, while you’re readed uh there we go okay, so it’s setup Heroku. For me, it’s building my docker container that was built that was generated for me in Buffalo, and now it’s doing yarn stuff for all that JavaScript I’ve added it’s linking dependencies building fresh packages. It’s sad! It’s like the D acid stuff takes so much longer than the ghost stuff and we’re almost done there.

There we go. Okay, we are making sure we have all of our dependencies. We are building the binary here now we’re in the go Buffalo build world here, I’m going to build a statically linked binary with the static flag. There we go. It’s building everything there are all assets got built production great. Now, we’ve moved it into Alpine. We using multistage docker here we are pushing to Heroku, hopefully pushed come on, come on Wi-Fi here we go we’re running our migrations on Heroku.

I remember this is actually all happening inside an alpha alpine container has just my binary in it. It has zero other files. There we go, I’ve migrated my database, here’s my database config. It’s going to open up my brand-new Heroku app here. Hmm, look at that right, wow, that’s pretty cool, and then I go to my widgets. There we go and I can create a new widget, and this is all working just fine all right.

That’s an easy, pleasant experience for anybody, probably not the experience you had trying to write a go app for the very first time. I’ve generated a ton of code. Admittedly, but writing these code writing this code is not that complicated if we go back really quick to the home handler here. This is a pretty good example of what a buffalo handler looks like they’re, really simple, and whether you agree with the a concept of them being simple or not.

We can definitely take that offline Florin and I had a law have had long discussions both online and offline about this, not being a kind of standard go type, you know, do use standard go handler, but the reason it’s not is because we want trying to make This as easy as possible for everybody absolutely is dead, simple possible for new people coming in, and this is as poss as simple as we can possibly get it.

You have a handler, you take a context to return an error and we will handle the error for you. We give you ways to handle the error on your own and you can easily plug in your own custom error handlers, but by default we’ve got your back and if you don’t believe me, take a look at the one you’re with here we go on. That’s a list of production, isn’t it let’s look at this route shouldn’t exist here we go here’s! What an error looks like in development mode, for example, so invalid type for UUID that not a UUID.

I can imagine that we could see the whole stack trace here. We could see what is currently in the context of this request. What are we looking at? What are parameters? Do we get? Were there any form arguments and what routes do we have, because maybe this is a 404 page? So again it’s about development. We are trying to make your life as good as possible, but giving you as much information as we possibly can as to what went wrong and why it went wrong and yeah and then we’ve got.

We’ve only got five minutes left, so you know I’m actually to stop it here and take just five minutes worth of questions. There’s so much more. I can show you, but I highly encourage you to go but go to go. Buffalo dot IO, there’s tons of great docs if you’re looking for good PR Doc’s are always a great first PR, the blog blog go Buffalo dot. Io I’ve got insane amounts of article and blogging content.

I actually have an entire 20 minute article. I need to post about writing custom helpers and NGO that I posted in the selection and we have our own slack general. The buffalo slack blog, I posted in there the other day, but it still needs to go up in the blog, so check that out go to the slack blog tweet me. I’ve got stickers by the way: awesome ashley, mcnamara, buffalo stickers and magnets whoo.

No one else is giving you magnets people revell, isn’t giving you magnets bigos, not giving you magnets, IRS, definitely ain’t giving you magnets they’ll. Take your magnets. I really should have said that, but no I didn’t mean to say BAE. He he will take your magnets. No too far, just a little bit a little bit. Okay, okay, so we got time for just like couple questions. Are there any questions right here in the front? I could hear you it is.

Is there a MongoDB plugin back? That is an excellent question. Pop is does not support MongoDB. Currently, I would love it if it could. I don’t know if I can or not. However, you can skip pop and bring Mongo to the table, but you don’t get. Is the generators that we have won’t work for you? However, we have plugins, as we saw with the Heroku one. If I do, you know Buffalo help. I should have a couple plugins here right, plug-in tools for deploying helpers.

I don’t have any other plugins right now, so you could absolutely right. You could be the person who owns the Buffalo Mongo plug-in that supports all this stuff. Has nice generators and everything mm-hmm? It would be awesome because I’m not doing it other questions right there, not so much question. But could you just show us the console working because I’m sure the console is getting a big refresh, we’re currently using library called door? But what do we have? We have widgets right.

So I can say you know, models widget and then models DB. First, there we go and if I print off the widget there we go and then obviously I can update the widget. I can do whatever I want with the widget, but yeah we’ve got a new console in the works. That’s going to blow this away and it’s going to also be standalone too, so you could use it in your own projects, not just buffalo projects but yeah you or you can currently do that.

We can’t control it programmatically and that’s our big downside with but yeah. This is really cool, that’s one of my favorite parts, and so many people don’t even realize it’s there, yeah cool. I think we got one more question time for one more right over there wait for the mic. Thank you. My mouth, nice talk. Thank you. How can we collaborate? What is the feature that you need to implement or something that you wish you have, but you don’t have time to do it what’s the Fisher the feature I wish we had, but I don’t have time to do.

Oh god, I don’t know, there’s a lot, we’re not there yet we’re not at one. Oh and that’s important to know. I don’t have a good answer for you honestly, because there’s a lot of things, I would like to see more database support, MySQL Oracle. Any of those things are always awesome, more plugins for deploying to tools like GAE or other. You know Asher whatever, like I’d love, to see plug-ins for that stuff, but just on the 100 front, we’re at 0, 9 3 came out this week, we’re not going to 1o anytime soon and that’s not because we’re afraid, but because we want to have the same Compatibility promise that go has so once we hit 100.

We are going to stay with that implementation forever. Well, not forever till oh, but we don’t want to make oh like three weeks later right. We want you to have stable applications with that said, Buffalo. The o9o range has been incredibly stable between upgrades apps. Almost nothing has changed that you’ve needed to tweak so right now, if you go from oh a 209, for example, there are some changes there, but they weren’t even that steep, actually, so we’re definitely leveling off yeah cool.

I think that’s all I have time for. Thank you very much come find me four stickers and magnets


 

By Jimmy Dagger

Find out my interests on my awesome blog!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.