<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alexander Nyaga</title>
    <description>The latest articles on DEV Community by Alexander Nyaga (@alexander784).</description>
    <link>https://dev.to/alexander784</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1122765%2F8ddd67ae-bd65-4002-b5a5-94631080ea41.jpeg</url>
      <title>DEV Community: Alexander Nyaga</title>
      <link>https://dev.to/alexander784</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alexander784"/>
    <language>en</language>
    <item>
      <title>Building a RESTFul RecipeAPI with Django and SQlite</title>
      <dc:creator>Alexander Nyaga</dc:creator>
      <pubDate>Sun, 01 Sep 2024 13:33:30 +0000</pubDate>
      <link>https://dev.to/alexander784/building-a-restful-recipeapi-with-django-and-sqlite-36i1</link>
      <guid>https://dev.to/alexander784/building-a-restful-recipeapi-with-django-and-sqlite-36i1</guid>
      <description>&lt;p&gt;Introduction:&lt;/p&gt;

&lt;p&gt;In web development, creating robust and scalable apps is the most important goal. Django, a high-level Python web framework, provides a comprehensive toolkit for easily developing sophisticated web applications. When creating RESTful APIs, the Django Rest Framework (DRF) stands out as a top solution, offering a comprehensive collection of tools to tackle the complexities of API development.&lt;/p&gt;

&lt;p&gt;This article will walk you through creating a simple yet working Recipe CRUD (Create, Read, Update, Delete) application with Django and the Django Rest Framework. We will explore the core concepts, step-by-step implementation, and best practices for ensuring your application is both stable and manageable. Whether you are a seasoned developer or just starting with Django and DRF, this article will provide a simple yet comprehensive path to creating a fully usable CRUD API.&lt;/p&gt;

&lt;p&gt;Prerequisites:&lt;/p&gt;

&lt;p&gt;Before getting started, make sure you have the following installed:&lt;/p&gt;

&lt;p&gt;Python: You can download Python from the official website (&lt;a href="https://www.python.org/downloads/" rel="noopener noreferrer"&gt;https://www.python.org/downloads/&lt;/a&gt;) and install it based on your operating system.&lt;br&gt;
Django and the Django REST framework: Install Django and the Django REST framework using pip (Python package manager) by running the following command:&lt;/p&gt;

&lt;p&gt;Step 1: Set up your project:&lt;/p&gt;

&lt;p&gt;We start by setting up a new Django project and app:&lt;/p&gt;

&lt;p&gt;In your terminal, create a new directory for the project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a virtual environment and activate it:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7tuzhqtkqejxs51fmry.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7tuzhqtkqejxs51fmry.png" alt="Image description" width="704" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new Django project and app:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Step 2: Register the app and REST framework in settings:&lt;/p&gt;

&lt;p&gt;Step 3: Define the Food model&lt;/p&gt;

&lt;p&gt;Step 4: Database Configurations:&lt;br&gt;
We are using the default database that comes with django:&lt;/p&gt;

&lt;p&gt;Step 5: Create the API views:&lt;/p&gt;

&lt;p&gt;Step 6: Create the API serializer&lt;/p&gt;

&lt;p&gt;Step 7: Configure the URLs:&lt;/p&gt;

&lt;p&gt;Step 8: Run the development server:&lt;/p&gt;

&lt;p&gt;Testing the API:&lt;/p&gt;

&lt;p&gt;When the server starts, you should see an output showing that the development server is up and running. By default, it listens at &lt;a href="http://127.0.0.1:8000/" rel="noopener noreferrer"&gt;http://127.0.0.1:8000/&lt;/a&gt; or &lt;a href="http://localhost:8000/" rel="noopener noreferrer"&gt;http://localhost:8000/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To interact with and read responses from your API endpoints, use a tool like curl, Postman, or a web browser.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;To test the recipe list, navigate to &lt;a href="http://localhost:8000/recipe_app/" rel="noopener noreferrer"&gt;http://localhost:8000/recipe_app/&lt;/a&gt; in your web browser or use curl to send a GET request to the URL.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To test the recipe_detail view, enter the ID of the recipe item you want to see. For example, go to &lt;a href="http://localhost:8000/recipe_app/1/" rel="noopener noreferrer"&gt;http://localhost:8000/recipe_app/1/&lt;/a&gt; in your web browser or use curl to send a GET request to the URL.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To test the create_recipe view, use curl to make a POST request to &lt;a href="http://localhost:8000/recipe_app/" rel="noopener noreferrer"&gt;http://localhost:8000/recipe_app/&lt;/a&gt; with the data for creating a new recipe.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After creating a new recipe, you receive a message,a new recipe was successfully created.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;To test the update_recipe view, use Postman to make a PUT request to &lt;a href="http://localhost:8000/recipe_app/" rel="noopener noreferrer"&gt;http://localhost:8000/recipe_app/&lt;/a&gt; with the data for updating an existing recipe. Replace with the ID of the recipe you want to update. Before updating&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To test the delete_recipe view, use postman to make a DELETE request to &lt;a href="http://localhost:8000/recipe_app/" rel="noopener noreferrer"&gt;http://localhost:8000/recipe_app/&lt;/a&gt; /. Replace with the ID of the food item you want to delete:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Check the server’s responses to ensure that the API is working properly.&lt;/p&gt;

&lt;p&gt;Remember to tailor the testing to your individual API requirements and use case. You can also utilize tools like Postman to provide a more user-friendly API testing experience.&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;/p&gt;

&lt;p&gt;With Django and SQlite, you have successfully constructed a Recioe API. The API offers endpoints for creating new recipes, updating current recipe, deleting recipes, and listing all recipes. You can modify this API further in accordance with the needs of your project or use it as a basis for developing more intricate django projects.&lt;/p&gt;

&lt;p&gt;When putting your API into production, don’t forget to take the necessary security precautions, such as managing authorization and authentication as needed.&lt;/p&gt;

&lt;p&gt;Github link:&lt;a href="https://github.com/alexander784/Recipe_API" rel="noopener noreferrer"&gt;https://github.com/alexander784/Recipe_API&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Crafting An Awesome README</title>
      <dc:creator>Alexander Nyaga</dc:creator>
      <pubDate>Wed, 04 Oct 2023 03:28:13 +0000</pubDate>
      <link>https://dev.to/alexander784/crafting-an-awesome-readme-1697</link>
      <guid>https://dev.to/alexander784/crafting-an-awesome-readme-1697</guid>
      <description>&lt;p&gt;A professionally written Readme file will alleviate your project's readers and developers’ headaches. Before you give a presentation or chat about the project, a readme presents it to the audience.&lt;br&gt;
Every readme file you publish has a md extension because a readme is written in a basic language termed markdown, which makes formatting and editing a breeze. A well-written readme can make the difference between your project being recognized by the development community as a gem or a superstar. The secrets of creating a readme that not only attracts attention but also keeps users and other developers informed and enthusiastic about your project are revealed in this article. &lt;br&gt;
Important components and pointers for making a README juicy:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Title and Summary
Start with a title that is simple and obvious (the unheard 
tune).&lt;/li&gt;
&lt;li&gt;The table of contents.
This applies to lengthy README files; for easier browsing, you 
 should think about incorporating a table of contents with 
 links 
to different sections.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Instructional manuals:&lt;/p&gt;

&lt;p&gt;a. Provide step-by-step instructions for installing your &lt;br&gt;
    project's prerequisites or dependencies. &lt;br&gt;
b. To make the installation process simpler to understand, use &lt;br&gt;
   code snippets or terminal commands.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Usage:&lt;br&gt;
 a. Describe the usage of your project. Include illustrations, &lt;br&gt;
    samples of code, and perhaps screenshots.&lt;br&gt;
 b. Discuss any advanced features as well as fundamental use &lt;br&gt;
     cases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Contributing: &lt;br&gt;
     a. Explain how to file pull requests, report issues, and &lt;br&gt;
       adhere to code standards.&lt;br&gt;
     b. Promote participation in your project by laying &lt;br&gt;
         forth the requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;License: &lt;br&gt;
   Indicate the license that your project is distributed &lt;br&gt;
  under. This is essential for moral and legal reasons.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A great README should be organized clearly, targeted at the right audience, and short. Common questions should be addressed, making it simple for users to get started, and fostering confidence in your project.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
