TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Are micro web frameworks a good fit in 2022?

1 点作者 kgraves超过 3 年前
Hi HN,<p>Been looking to create a quick web app sometime in the new year and have been seeing recent posts on HN about Ruby on Rails (now that 7 has released) and Django 4 as well. I&#x27;ve also seen similar praise for Phoenix as well.<p>I haven&#x27;t seen the same love for micro web frameworks like Flask, Sinatra etc, but always seen the above 3 as bloated but not quite sure.<p>So as the title suggests, are micro web frameworks still a good fit? What are your thoughts on this and how is the ecosystem around this?<p>Bonus if you are using them.

3 条评论

square_usual超过 3 年前
Others have covered good, general rules of thumb, but I&#x27;ll go into a few specifics for why I generally avoid microframeworks. I&#x27;ve spent quite a bit of time with Rails, and whenever I try a microframework I&#x27;m <i>immediately</i> aware of all that Rails does for me - for free! Here&#x27;s a few things I had to set up:<p>1. Configuration: This is way more important than you&#x27;d think and very difficult to get right. Consider storing aws credentials etc - Rails has a great, in built pattern for storing and accessing them, and the initializers pattern allows you to load them without contaminating the rest of your codebase with it. Plus, environment specific configs - especially env specific db configs - are super tight to have for essentially free.<p>2. Logging: more of a pain to get right than you&#x27;d think! Rails gives you an easy way to log anywhere, environment specific logging rules, logging to file and console and other such nice to haves.<p>3. DB access: You don&#x27;t have to think about setting up connection pools or an ORM - it&#x27;s built in and pretty capable. With microframeworks you have to hand roll the entire db access layer.<p>4. The glue: this is the biggest thing. You&#x27;ll know it when you&#x27;re three weeks deep into building a &quot;micro&quot; service and you realise you&#x27;ve essentially made Rails in Sinatra, except worse because it&#x27;s buggy and poorly documented.<p>I love toying around with microframeworks - it&#x27;s the best way to learn what goes on behind the scenes of a complex framework like Rails - but unless you knoe <i>exactly</i> what you need and why the mciroframework is better you&#x27;re probably better off with Rails.
johncoltrane超过 3 年前
Use what you are already familiar with. Searching for a framework that fits unknown criteria is only a way to postpone actual work.
detaro超过 3 年前
&quot;A good fit&quot; doesn&#x27;t make sense to discuss without a context of &quot;for who&quot; and &quot;for what&quot;.
评论 #29647601 未加载