You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4 KiB
Markdown

3 years ago
---
title: SI16 API node.js + express prototype
description: Test for an API-based special issue
date: 14/11/2021
git:
categories:
- Web
- API
- REST
- SI16
---
## Test for an API-based special issue
- The backend is developed with node.js and express
- Each URL is mapped to a python script. The argument are passed to the script, processed and then returned as JSON
- We start with 2 functions: 1. a find and replace and 2. a shout
(__update:__ hei this is not active anymore! [but we really did an API at the end!](issue.xpub.nl/16) aha!)
## Wait what why an API
![two half bikes attacched with tape and two kids pretty satisfied with their work](/soupboat/~kamo/static/img/api_bikes.jpg)
This is to show what an API could be in relation to the exercises we usually do during the prototyping class.
It is a way to render public a piece of work that usually stays behind several layers of accessibility.
The idea of the special issue as an API could be a curated collection of what we are doing since september within a critical context. 🤯
### Find and Replace
Find a target string in a text and replace it with the given replacement. The parameters are three.
- `text` the text in which perform the research
- `target` the string we are searching for
- `replacement` the string we want to insert in place of the target
The endpoint is:
`https://hub.xpub.nl/soupboat/cat-api/replace?text={text}&target={target}&replacement={replacement}`