<?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: Mr. Glass</title>
    <description>The latest articles on DEV Community by Mr. Glass (@mrglass).</description>
    <link>https://dev.to/mrglass</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%2F299547%2F7e30f26c-a122-4986-8832-3e75d70063ae.png</url>
      <title>DEV Community: Mr. Glass</title>
      <link>https://dev.to/mrglass</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mrglass"/>
    <language>en</language>
    <item>
      <title>Simple inline django endpoint</title>
      <dc:creator>Mr. Glass</dc:creator>
      <pubDate>Mon, 23 Dec 2019 18:35:08 +0000</pubDate>
      <link>https://dev.to/mrglass/simple-inline-django-endpoint-1efe</link>
      <guid>https://dev.to/mrglass/simple-inline-django-endpoint-1efe</guid>
      <description>&lt;p&gt;In 99% of cases, it is terrible practice to do this. I managed to find the 1% case today.&lt;/p&gt;

&lt;p&gt;You need to add a simple endpoint to your django application. Its so simple it doesn't deserve it's controller or even it's own view class. In my case, I had a healthcheck endpoint, that should simply always return 'Success'. Normally an endpoint requires additional functions/classes etc, but since I am just returning a string I wanted to just write my string inline. Turns out you can!&lt;/p&gt;

&lt;p&gt;In urls.py, add the following to your routes list:&lt;br&gt;
&lt;code&gt;path('healthcheck', (lambda x:HttpResponse("Success"))),&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Make sure you import HttpResponse at the top of the file, if you haven't already:&lt;br&gt;
&lt;code&gt;from django.http import HttpResponse&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That's it!&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
    </item>
  </channel>
</rss>
