<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Srishanmandawala on Medium]]></title>
        <description><![CDATA[Stories by Srishanmandawala on Medium]]></description>
        <link>https://medium.com/@srishanmandawala?source=rss-c323df0e77d9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LRuipya-7o3_oEHGpmqQIg.jpeg</url>
            <title>Stories by Srishanmandawala on Medium</title>
            <link>https://medium.com/@srishanmandawala?source=rss-c323df0e77d9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 08:19:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@srishanmandawala/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Python වලින් API හදන අයට FastAPI නැතුවම බැරි ඇයි?]]></title>
            <link>https://medium.com/@srishanmandawala/python-%E0%B7%80%E0%B6%BD%E0%B7%92%E0%B6%B1%E0%B7%8A-api-%E0%B7%84%E0%B6%AF%E0%B6%B1-%E0%B6%85%E0%B6%BA%E0%B6%A7-fastapi-%E0%B6%B1%E0%B7%90%E0%B6%AD%E0%B7%94%E0%B7%80%E0%B6%B8-%E0%B6%B6%E0%B7%90%E0%B6%BB%E0%B7%92-%E0%B6%87%E0%B6%BA%E0%B7%92-e1be8ab985c0?source=rss-c323df0e77d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1be8ab985c0</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Srishanmandawala]]></dc:creator>
            <pubDate>Fri, 04 Jul 2025 04:08:47 GMT</pubDate>
            <atom:updated>2025-07-04T04:28:20.962Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Python වලින් API හදන අයට FastAPI නැතුවම බැරි ඇයි?</strong></p><blockquote>වේගය, පහසුව සහ ස්වයංක්‍රීය Docs එක්ක එන Python වල සුපිරිම Web Framework එක ගැන සරලව.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*gjym-eYvhGncEfFJy8Ut6g.png" /></figure><p>අද කාලේ වෙබ් සහ මොබයිල් ඇප්ලිකේෂන් හදනකොට “API” (Application Programming Interface) කියන වචනේ නිතරම ඇහෙන දෙයක්. සරලවම කිව්වොත්, ඇප් එකක front-end (පරිශීලකයාට පේන කොටස) එකයි, back-end (data තියෙන, logic එක වැඩ කරන කොටස) එකයි අතර දත්ත හුවමාරු කරගන්න පාලමක් තමයි API එකක් කියන්නේ.</p><p>Python වලින් API හදන්න Django Rest Framework, Flask වගේ ගොඩක් options තිබුණත්, මෑත කාලයේදී ගොඩක් දෙනෙක් අතර වේගයෙන් ජනප්‍රිය වුණු framework එකක් තමයි FastAPI.</p><p>මේ ලිපියෙන් අපි බලමු FastAPI කියන්නේ මොකක්ද, ඒක පාවිච්චි කරන්න හේතු මොනවද, සහ හරිම සරල API එකක් විනාඩි 5න් හදාගන්නේ කොහොමද කියලා.</p><h4>FastAPI කියන්නේ මොකක්ද? (What is FastAPI?)</h4><p>FastAPI කියන්නේ Python 3.7+ වලින් API හදන්න නිර්මාණය කරපු, ඉහළ කාර්යක්ෂමතාවයකින් යුතු (high-performance) නවීන web framework එකක්. නමේ තියෙන විදිහටම, “Fast” කියන එක තමයි මෙයාගේ ප්‍රධානම ලක්ෂණය.</p><p>මේක හදලා තියෙන්නේ ප්‍රධාන කොටස් දෙකක් උඩ:</p><ol><li><strong>Starlette:</strong> Web කොටස් සඳහා (අතිශය වේගවත්).</li><li><strong>Pydantic:</strong> Data validation (දත්ත තහවුරු කිරීම) සඳහා.</li></ol><p>මේ දෙකේ එකතුව නිසා FastAPI වලට පුදුම වේගයක් සහ හැකියාවන් රැසක් ලැබිලා තියෙනවා.</p><h4>FastAPI පාවිච්චි කරන්නේ ඇයි? (Why use FastAPI?)</h4><p><strong>1. අතිශය වේගවත් (Extremely Fast):</strong><br>FastAPI වල වේගය NodeJS සහ Go වැනි වේගවත් frameworks වලට සමාන මට්ටමක තියෙනවා. මේකට හේතුව තමයි යටින් දිවෙන Starlette සහ asyncio කියන Python library එක. එකවර එන requests විශාල ප්‍රමාණයක් වුණත් අඩු සම්පත් ප්‍රමාණයක් පාවිච්චි කරලා FastAPI වලට handle කරන්න පුළුවන්.</p><p><strong>2. ඉගෙනගන්න සහ Code කරන්න ලේසියි (Easy to Learn and Code):</strong><br>FastAPI වල syntax එක හරිම සරලයි සහ පිරිසිදුයි. Python ගැන මූලික දැනුමක් තියෙන කෙනෙක්ට খুব ඉක්මනින් FastAPI ඉගෙනගන්න පුළුවන්. අඩු කෝඩ් ප්‍රමාණයකින් වැඩි වැඩක් කරගන්න පුළුවන් වීම මෙහි තවත් වාසියක්.</p><p><strong>3. ස්වයංක්‍රීයව හැදෙන Docs (Automatic Documentation):</strong><br>මේක තමයි FastAPI වල තියෙන සුපිරිම feature එකක්! ඔබ API එක හදනකොටම, ඒකට අදාළව ලස්සන, interactive documentation එකක් FastAPI විසින්ම ස්වයංක්‍රීයව හදනවා.</p><ul><li><strong>Swagger UI (/docs):</strong> ඔබට API endpoints බ්‍රවුසරය හරහාම test කරන්න පුළුවන්.</li><li><strong>ReDoc (/redoc):</strong> ලස්සනට පිළිවෙළකට සකස් කරපු documentation එකක්.</li></ul><p>මේ නිසා API එක හදන ගමන්ම ඒකේ document එකත් හැදෙන නිසා අමතර කාලයක් වැය වෙන්නේ නැහැ.</p><p><strong>4. Type Hints සහ Data Validation:</strong><br>FastAPI Python වල Type Hints පාවිච්චි කරනවා. මේ නිසා එන request වල data (උදා: user කෙනෙක්ගේ නම string එකක්ද, වයස integer එකක්ද) ස්වයංක්‍රීයව validate වෙනවා. වැරදි data type එකක් ආවොත්, FastAPI විසින්ම පැහැදිලි error message එකක් දෙනවා. මේකෙන් code එකේ bugs අඩු වෙනවා වගේම, code එක හරිම ශක්තිමත් වෙනවා.</p><h4>අපි අපේ පළවෙනි API එක හදමු! (Let’s build our first API!)</h4><p><strong>පියවර 1: අවශ්‍ය දේවල් Install කරගැනීම</strong></p><p>මුලින්ම ඔබේ computer එකේ Python තියෙන්න ඕනේ. ඊටපස්සේ terminal එක open කරලා මේ command එක run කරන්න.</p><pre>pip install fastapi uvicorn</pre><ul><li><em>fastapi: මේක තමයි framework එක.</em></li><li><em>uvicorn: මේක තමයි අපේ API එක run කරන server එක</em></li></ul><p><strong>පියවර 2: Code එක ලියමු</strong></p><p>ඔබ කැමති code editor එකක් (VS Code වගේ) open කරලා, main.py කියලා අලුත් file එකක් හදාගන්න. දැන් ඒකේ මේ code එක paste කරන්න.</p><pre>from fastapi import FastAPI<br><br># FastAPI instance එකක් හදාගන්නවා<br>app = FastAPI()<br><br># Root URL එකට (/) එන GET request එකක් handle කරන function එක<br>@app.get(&quot;/&quot;)<br>def read_root():<br>    return {&quot;message&quot;: &quot;Hello, FastAPI World!&quot;}<br><br># වෙනත් endpoint එකක් හදමු<br>@app.get(&quot;/items/{item_id}&quot;)<br>def read_item(item_id: int, q: str | None = None):<br>    return {&quot;item_id&quot;: item_id, &quot;q&quot;: q}</pre><p><strong><em>Code එකේ මොකක්ද වෙන්නේ?</em></strong></p><ul><li><em>app = FastAPI() වලින් අපි FastAPI app එකක් හදාගත්තා.</em></li><li><em>@app.get(“/”) කියන්නේ කවුරුහරි අපේ API එකේ root URL (/) එකට GET request එකක් එව්වොත්, ඒකට පහළින් තියෙන read_root function එක run කරන්න කියන එක.</em></li><li><em>read_root() function එකෙන් { “message”: “හෙලෝ, FastAPI ලෝකය!” } කියන JSON response එක ආපහු යවනවා.</em></li><li><em>දෙවෙනි endpoint එකේ {item_id} කියන්නේ path parameter එකක්. ඒ කියන්නේ /items/5 වගේ request එකක් ආවොත්, item_id එක 5 වෙනවා.</em></li></ul><p><strong>පියවර 3: API එක Run කරමු</strong></p><p>Terminal එකේ, ඔබ main.py file එක save කරපු තැනට ගිහින් මේ command එක run කරන්න.</p><pre>uvicorn main:app --reload</pre><ul><li><em>main: main.py file එක.</em></li><li><em>app: file එක ඇතුළේ අපි හදපු FastAPI object එක.</em></li><li><em>- -reload: අපි code එකේ වෙනසක් කරලා save කරපු ගමන් server එක auto-restart වෙන්න.</em></li></ul><p><em>දැන් terminal එකේ මෙන්න මේ වගේ output එකක් පෙනෙයි:<br>INFO: Uvicorn running on </em><a href="http://127.0.0.1:8000/"><em>http://127.0.0.1:8000</em></a><em> (Press CTRL+C to quit)</em></p><p><strong>පියවර 4: ප්‍රතිඵලය සහ Docs බලමු</strong></p><p>දැන් ඔබේ web browser එක open කරලා මේ URL එකට යන්න:</p><p><a href="http://127.0.0.1:8000/">http://127.0.0.1:8000</a></p><p>ඔබට මෙහෙම පෙනෙයි:</p><pre>{&quot;message&quot;:&quot;Hello, FastAPI World!&quot;}</pre><p>දැන් තමයි නියම මැජික් එක! මේ URL එකට යන්න:</p><p><a href="http://127.0.0.1:8000/docs">http://127.0.0.1:8000/docs</a></p><p>ඔබට ලස්සන interactive Swagger UI එකක් පෙනෙයි. එතන තියෙන /items/{item_id} endpoint එක උඩ click කරලා “Try it out” button එක ඔබලා, item_id එකට අංකයක් දීලා “Execute” කරන්න. බලන්න, API එක browser එකෙන්ම test කරන්න පුළුවන්!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*xGpKkkLdVPLOUG6wySV_DA.png" /></figure><h4>අවසාන වශයෙන්</h4><p>FastAPI කියන්නේ Python වලින් API හදන අයට ලැබුණු වටිනා තෑග්ගක්. එහි වේගය, භාවිතයේ පහසුව, ස්වයංක්‍රීයව හැදෙන documentation, සහ ශක්තිමත් data validation නිසා කුඩා personal project එකක ඉඳන් විශාල production-level application එකක් දක්වා ඕනෑම දෙයකට මෙය ඉතාම සුදුසුයි.</p><p>ඔබ Python developer කෙනෙක් නම් හෝ back-end development වලට අලුත් කෙනෙක් නම්, FastAPI කියන්නේ අනිවාර්යයෙන්ම ඉගෙනගත යුතු දෙයක්.</p><p>Happy coding…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1be8ab985c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Next.js Routing: A Beginner-Friendly Guide]]></title>
            <link>https://medium.com/@srishanmandawala/mastering-next-js-routing-a-beginner-friendly-guide-2b2f13c150a5?source=rss-c323df0e77d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b2f13c150a5</guid>
            <category><![CDATA[nextjsrouting]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[routing]]></category>
            <dc:creator><![CDATA[Srishanmandawala]]></dc:creator>
            <pubDate>Tue, 27 May 2025 07:11:14 GMT</pubDate>
            <atom:updated>2025-05-27T07:16:14.454Z</atom:updated>
            <content:encoded><![CDATA[<p>Routing is at the heart of every modern web application. With <strong>Next.js</strong>, routing becomes <strong>simpler, faster, and more intuitive</strong> — thanks to its <strong>file-based routing system</strong>.</p><p>In this article, I’ll break down how routing works in Next.js, covering:</p><blockquote>File-based routing structure</blockquote><blockquote>Dynamic and nested routes</blockquote><blockquote>Shallow routing</blockquote><blockquote>Catch-all routes</blockquote><blockquote>Link navigation using next/link</blockquote><blockquote>Bonus tips from my experience</blockquote><p>Whether you’re just starting with Next.js or want a refresher, this guide will give you a clear, practical understanding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yH_T2MwYS1TMfHWCWfycWw.png" /></figure><h3>File-Based Routing: Simplicity at Its Best</h3><p>Unlike traditional React apps where we use libraries like React Router, <strong>Next.js handles routing based on the file structure inside the </strong><strong>pages/ directory</strong>.</p><p><em>/pages<br> └── index.js → ‘/’<br> └── about.js → ‘/about’<br> └── contact.js → ‘/contact’</em></p><h3>Dynamic Routes</h3><p>Want to render pages based on dynamic values (like user profiles, blog posts, etc.)?</p><p>Use square brackets ([ ]) in filenames.</p><p><em>/pages<br> └── blog<br> └── [slug].js → ‘/blog/my-first-post’</em></p><p>You can access the dynamic value using the useRouter hook:</p><pre>import { useRouter } from &#39;next/router&#39;;<br><br>const BlogPost = () =&gt; {<br>  const router = useRouter();<br>  const { slug } = router.query;<br>  return &lt;h1&gt;Reading: {slug}&lt;/h1&gt;;<br>};</pre><h3>Nested Routes</h3><p>You can structure nested pages by creating folders:</p><p><em>/pages<br> └── dashboard<br> └── index.js → ‘/dashboard’<br> └── settings.js → ‘/dashboard/settings’</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hkBK-_TnyB2qeLpbWOkc_Q.png" /></figure><h3>Want to Dive Deeper?</h3><p>Next.js routing is incredibly powerful, and this article just scratches the surface. For an in-depth guide — including new features introduced in <strong>Next.js 13</strong> using the <strong>App Router</strong> — check out the official docs:</p><p>👉 <a href="https://nextjs.org/docs/13/app/building-your-application/routing">Next.js 13 Routing Documentation</a></p><h3>Final Thoughts</h3><p>Next.js makes routing <strong>effortless yet powerful</strong>. As a full-stack developer, I’ve enjoyed how Next.js handles routing without overwhelming me with configs. If you’re working on projects like admin dashboards, blogs, or eCommerce apps — mastering routing will seriously boost your productivity.</p><p>Happy coding! 💻✨</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b2f13c150a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>