Skip to main content

Posts

Showing posts from 2023

Tech Art Bits: Making a basic Web API with Clacks

If you read my first tutorial on "getting started with Clacks" , you might have thought to yourself, not entirely unfairly, that it is not very convenient to _need_ clacks to talk to a clacks server. This is entirely true, and precisely for this reason, in this tutorial, we will be diving into creating a simple HTTP server using standard REST API methods (GET, POST). In this tutorial, we will need two libraries as prerequisite installs for the code snippets to work, Which can both be found on the github pages that are linked if you click on them below. clacks clacks_web Of course, as always, you can download the sample content for this tutorial here: https://github.com/MaVCArt/clacks_tutorials/tree/main/02_SimpleWebAPI Table of Contents Step 1: Create a simple REST API server As before, you can see that the standard clacks_web library offers most of what you need out of the box. In fact, it takes fewer lines of code to build a simple REST API with clacks_we

Tech Art Bits: Getting started with Clacks

clacks  (find it here on github: https://github.com/MaVCArt/clacks ) is a modular TCP framework, designed to be as extensible as possible through the user of various factory-pattern and class-composition-inspired techniques.  In this article, we'll go through a step-by-step guide on how to set up your own server instance in a native python interpreter, and how to attach your code to it through the ServerInterface class, which comes built-in with the vanilla clacks environment. This is repeated at the end of the article, but if you want to skip right to the end and just download the code, you can do so here: https://github.com/MaVCArt/clacks_tutorials/tree/main/01_GettingStarted Table of Contents Step 1: setting up the server First, run the following pip command to install the clacks library; pip install git+https://github.com/MaVCArt/clacks.git@main This will install the default library, with all the bits and pieces you will need to get a fully functional server