Hacker News new | past | comments | ask | show | jobs | submit login

I use the standard library. My entire business runs on it, html/css all through the standard library (templates package).

I use embed to embed all assets in the binary itself. "go build" and then "scp" the binary to the production server and "systemctl restart appserver"




Love that you do this. I have a few enterprise projects that do exactly the same thing (minus the embed in one, just scp and untar). Can’t beat the simplicity.

Regarding the original question we use fiber.io for a few systems and have loved it’s capabilities and performance.


> templates package

How do you like the template package ? Can you compare it to Jinja/Twig ?


I have never used Jinja/Twig, but I have used handlebars, ERB, JSX and other similar templating systems.

Overall, I find Go's template system to be a bit clunky but it certainly gets the job done. The template system is fairly minimal so it feels mostly like working with HTML, but it gives you a few tools to use.. mainly passing data down the template/sub-templates and the ability to define template functions/helpers. Minimal... but it's all you really need.

I converted my business from Rails 5 to Go about a year ago and the ERB was fairly straight forward to convert to Go's template system.. it felt like I was mostly converting <% .. %> to {{ .. }} and changing <%= render ... %> to {{ template ... }}


Thanks, I guess I should try the standard lib before anything else then.


What about scheduled jobs (cron), email notifications, database etc?


My server's binary is more than a server, it can execute one off tasks, etc. For example I can execute the server binary with special arguments, ex "server --task admin-reports" in a cron job.

For the database I use Postgresql with the standard library's database/sql package (using lib/pq as the driver).

For scheduled emails and tasks, I store them in Postgres and I have a task that is run through my server binary every few hours (ex: "server --task scheduled-tasks").




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: