今日已更新 61 条资讯 | 累计 26473 条内容
关于我们

开发者

编程技术、框架工具、最佳实践

7379
篇文章

共 7379 篇 · 第 286/369 页

Dev.to

IP geolocation with zero external APIs, the Cloudflare Workers cf object

When I built whatsmy.fyi , I assumed I'd need a geolocation provider: MaxMind, ipinfo, ip-api, pick your poison. They all mean the same thing: an external dependency, an API key, a quota, added latency, and someone else's server seeing your users' IPs. Then I found out Cloudflare Workers makes the whole category unnecessary. The cf object Every request that hits a Cloudflare Worker carries a request.cf object, populated at the edge before your code even runs. No lookup, no latency, no key. Here's what's inside: { asn : 34984 , // ISP's autonomous system number asOrganization : " Superonline " , // ISP name city : " Istanbul " , region : " Istanbul " , country : " TR " , continent : " AS " , isEUCountry : undefined , // "1" if EU, undefined otherwise latitude : " 41.01380 " , // string, not number! longitude : " 28.94970 " , postalCode : " 34000 " , timezone : " Europe/Istanbul " , colo : " IST " , // which CF datacenter handled this clientTcpRtt : 12 , // user's RTT to the edge, in ms httpProtocol : " HTTP/3 " , tlsVersion : " TLSv1.3 " , tlsCipher : " AEAD-AES128-GCM-SHA256 " } That last group surprised me most: you get the user's HTTP protocol, TLS version, and actual TCP round-trip time for free. Try getting that from a geo API. A complete IP endpoint in ~30 lines export default { async fetch ( request ) { const cf = request . cf ?? {}; const ip = request . headers . get ( " CF-Connecting-IP " ); return Response . json ({ ip , city : cf . city ?? null , country : cf . country ?? null , isp : cf . asOrganization ?? null , asn : cf . asn ?? null , timezone : cf . timezone ?? null , lat : cf . latitude ? parseFloat ( cf . latitude ) : null , lng : cf . longitude ? parseFloat ( cf . longitude ) : null , protocol : cf . httpProtocol ?? null , tls : cf . tlsVersion ?? null , rttMs : cf . clientTcpRtt ?? null , }); }, }; That's the entire backend. No database, no GeoIP file to update monthly, no vendor. The gotchas (learned the hard way) 1. Coordinates are strings. lati

Koray KÖYLÜ 2026-06-10 20:49 👁 13 查看原文 →
Reddit r/webdev

How many rows can a modern browser handle?

Hi, How many rows have you ever tried to render on html via <table> ? I need maybe north of 300k rows on one page and want to know if the browser will die ? submitted by /u/Yha_Boiii [link] [留言]

/u/Yha_Boiii 2026-06-10 19:29 👁 6 查看原文 →
Reddit r/programming

ReactJS Syntax For Web Components

Im investigating an idea i had about JSX for webcomponents after some experience with Lit. I am sharing this here because it might be interesting/educational for someone, if it isnt, let me know and i'll remove the post. Lit is a nice lightweight UI framework, but i didnt like that it was using class-based components. Vue has a nice approach but i prefer working with the syntax that React uses. I find it more intuitive for debugging and deterministic rendering. I wondered if with webcomponents, i could create a UI framework that didnt need to be transpiled. Read the docs Checkout the code Storybook demo (My intentions with this framework is to get to a reasonable level of stability, to then replace React on some of my existing projects.) IMPORTANT: Im not trying to promote "yet another ui framework", this is an investigation to see what is possible. You should not use this framework in your own code. It is not production-ready. It is not on NPM. Im not looking for another framework to replace React (im trying to create it). This framework is intended for myself on my own projects. This project is far from finished. Feel free to reach out for clarity if you have any questions. submitted by /u/Accurate-Screen8774 [link] [留言]

/u/Accurate-Screen8774 2026-06-10 19:20 👁 6 查看原文 →
Product Hunt

EndpointMe

Your identity as a live, queryable API endpoint Discussion | Link

Aditya Raj 2026-06-10 17:22 👁 4 查看原文 →
Dev.to

Django vs. Flask: Choosing the Right Python Framework for Your Business

The real question isn't which framework is better. It's which one you can stop thinking about six months into the project. Key Takeaways Project Suitability — Django is built for weight. Flask is built for speed. Know which one your project actually needs before you commit. Development Flexibility — Django makes decisions so your team doesn't have to. Flask hands those decisions back. Both are features, depending on who's writing the code. Scalability & Performance — Scaling is an architecture problem first, a framework problem second. Pick the one that matches the system you're building — not the one you hope to build. Security Features — Django's protections are on by default. Flask's require you to turn them on. In a fast-moving team, that difference is more significant than it sounds. Ecosystem & Community — Both communities are active and well-documented. You won't be stuck either way. The Decision Nobody Takes Seriously Enough I've watched this play out more times than I'd like to count. A team kicks off a Python project, someone picks a framework — usually the one the most senior person knows best — and everyone moves on. Fast forward six months and the codebase is exhausting to work in. Either they're dragging a full framework through a service that should've been twenty lines of Flask, or they're rebuilding authentication from scratch on something that outgrew its lightweight origins two sprints in. The framework choice isn't irreversible. But undoing it mid-project is expensive in a way that doesn't show up in any estimate. Django and Flask are both genuinely good. What they're good for is different. That's the part worth slowing down on. What You're Actually Getting With Each One Django arrives with almost everything a web application needs already assembled — an ORM, an admin panel, authentication, form handling, CSRF protection, and more. The design assumption is that most web applications need most of these things, so it makes more sense to ship them i

Sahil Khurana 2026-06-10 17:17 👁 10 查看原文 →
Dev.to

Welcome Thread - v379

Leave a comment below to introduce yourself! You can talk about what brought you here, what you're...

Sloan the DEV Moderator 2026-06-10 14:48 👁 8 查看原文 →
Reddit r/webdev

Has anyone seen this happen in Google Search Console?

I launched a content site about 2.5 months ago. Current stats: • ~250 pages published • ~196 pages indexed by Google • Pages are receiving organic traffic from Google, Bing, Reddit, HN, and social media • Brand searches are starting to appear on page 1 The strange part: Google Search Console still shows my sitemap as: "Couldn't fetch" with 0 discovered pages. Yet the sitemap URL loads fine in a browser, robots.txt references it correctly, and Google has clearly discovered and indexed hundreds of pages. At the same time, I noticed indexed pages dropped from ~238 to ~196, while "Crawled – currently not indexed" increased. I'm trying to figure out whether: Search Console is simply showing stale sitemap data Google is finding URLs through internal links and ignoring the sitemap This is a normal quality-filtering phase for a young site Or it's an early warning sign that Google isn't happy with the content Would love to hear from anyone who has experienced the combination of: • Sitemap = "Couldn't fetch" • Hundreds of pages indexed anyway • Growing "Crawled – currently not indexed" counts What happened next? submitted by /u/kamscruz [link] [留言]

/u/kamscruz 2026-06-10 14:40 👁 7 查看原文 →