So many people suggested http.zig based on what I liked and didn’t like about Zap and Zinc and I’m going to just refactor this project to that as a comparison. I’m not sure how but http.zig by KarlSeguin slipped under my radar, but it’s almost exactly what I’m looking for (or at least, from the readmes). I’ll probably toss the controller approach with that refactor, too.
@_xentropy2 күн бұрын
This is quickly becoming one of my favorite channels. Thanks for the Zig content.
@CodeWithCypert2 күн бұрын
You trying to make me cry? Because this is how you make me cry. 🥹
@matthieu8752 күн бұрын
i was learning rust for the last 3 months before that elixir i think i found my next shiny language lol, if you continue with zig content i hope ur channel will grow cause there isn't a lot on ytb and the language is getting a lot of traction recently with ghostty and primetime speaking about it
@CodeWithCypert2 күн бұрын
Ghostty looks so nice! I plan on trying it out soon! I was shocked to hear Prime talk about leaving Rust for Zig or Go, but it seems like he's been working with Jia (?) lately instead?
@matthieu875Күн бұрын
@@CodeWithCypert ghossty is cool but i prefer wezterm this one is in rust and it's really easy to customize cause there is only one config file in lua
@CodeWithCypertКүн бұрын
That sounds nice! I used Alacritty for a while but swapped back to iTerm, however, I’ve been using Ghostty all day to try it out and I’m already sold on it!
@romangeneral232 күн бұрын
Thanks for another excellent zig video.
@CodeWithCypert2 күн бұрын
Thank YOU for watching and participating in discussions! I’m glad you enjoyed the video!
@romangeneral23Күн бұрын
@@CodeWithCypert Quick question: Is there a standard that you followed to make the web server ? It is projects like this that can really make one understand and learn a language.
@CodeWithCypertКүн бұрын
@romangeneral23 can you clarify what you mean by standard? My thought process was this: “people have asked for HTTP server APIs in Zig, specifically with Zap. I build API servers all the time, just not in Zig. So let’s take what I know about servers in Go and TypeScript and find a minimal project to focus on the core competencies for this idea. Something simple - Postgres table with a single column, if you can add one column, you can add twenty. Same with the idea of a controller, if you learn how to make and register one, you’ll be able to do it again and again.” That boiled down to a single controller with a single table backing it, and keeping the data structure simple so I’m not bogged down in other things and can just focus on handling requests, dispatching handlers, parsing json, and executing queries. Hope that helps!
@romangeneral23Күн бұрын
@@CodeWithCypert Many centuries ago I wrote an HTTP server in C for my college final project. It involved sockets, memory management, etc. That's sorta where I am going with.
@CodeWithCypertКүн бұрын
Ah, I see. Generally I’ll try to use the highest level tools available to solve my needs, but not something that over-abstracts on my needs. For example, in Python, I would choose Flask for this project over something bigger like Django.
@marius.ileanaКүн бұрын
Reposting again (seems that my initial comment disappeared): First of all, thanks (again) for the sample, Brad! The problem with the potential memory leaks is that you called `_ = gpa.detectLeaks();` at the end of the `main` function. And that is executed before the `defer pool.init()`. That's why it will always complain about memory leaks, even if you just comment out all the other lines after your `defer pool.deinit()`. So, you can use `defer _ = gpa.detectLeaks()` right after the `gpa` variable initialization.
@CodeWithCypertКүн бұрын
Oh my gosh. What a silly mistake. Thank you for reposting, I’m not sure what happened with your comment. I went to find it and couldn’t. Lemme make sure KZbin didn’t hold your original for review, and thanks for helping highlight that issue.
@chrishabgood8900Күн бұрын
microsecond response time SWEET!!!
@CodeWithCypertКүн бұрын
BLAZINGLY FAST :)
@chrishabgood8900Күн бұрын
@ years ago when I was learning elixir I saw microseconds also.
@CodeWithCypertКүн бұрын
@ don’t you lie to me, Chris ;) I jest, of course :) years back I worked at a company that was using Elixir pretty heavily (Ruby shop that was moving to Elixir) and while I had a couple of common gripes about the syntax, I was really impressed with how fast Elixir and the BEAM truly was. I considered committing to only writing elixir but pain points with the syntax really started wearing down on me (I don’t like Ruby either for what it’s worth). What were you building in Elixir?
@chrishabgood8900Күн бұрын
@@CodeWithCypert nothing just started learning. I am ruby on rails dev.
@CodeWithCypertКүн бұрын
@ fair enough! Do you like RoR?
@EightSixxКүн бұрын
can we get a Zig SQLite tutorial now? :D
@CodeWithCypertКүн бұрын
I see you, and I’ll see what I can do!
@EightSixxКүн бұрын
Zinc looks way nicer :D
@CodeWithCypertКүн бұрын
I agree, but so many people have suggested http.zig by KarlSeguin and I am really digging that too. I am actually going to convert this project over to http.zig as a comparison
@pietraderdetective8953Күн бұрын
@@CodeWithCypert Jetzig is built on top oh http.zig and it's like the equivalent of Django and Rails in Zig. I actually posted a comment on this but it got deleted by YT.
@andrewpavlov9128Күн бұрын
This whole approach with endpoints and controllers feels wrong. Try out a "routes" example in zap's repo, looks way nicer.
@CodeWithCypertКүн бұрын
Originally I ended up taking the routes approach, but my understanding with endpoints are that they were effectively switching on the http request method so that I didn’t have to - which, if the framework is offering to do that, I feel like I’d want it to do. That being said, I really appreciate the feedback (and don’t disagree - I’ve mentioned that parts of the solution feel really weird). I may look at refactoring this to a routes based approach instead though.
@CodeWithCypertКүн бұрын
So many people suggested http.zig based on what I liked and didn’t like about Zap and Zinc and I’m going to just refactor this project to that as a comparison. I’m not sure how but http.zig by KarlSeguin slipped under my radar, but it’s almost exactly what I’m looking for (or at least, from the readmes). I’ll probably toss the controller approach with that refactor, too.
@seanknowles99852 күн бұрын
Maaaaaaaa man, you made my day thanks so much for this, whats your handle on twitter? I will pm you and send a pack of beers.
@CodeWithCypertКүн бұрын
@bradcypert - feel free to PM me (I love talking with everyone) but if you wanna take the beer money and donate it to your local animal shelter, that’d make my day :)