Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 2.35 KB

README.md

File metadata and controls

69 lines (49 loc) · 2.35 KB

Noswearwords_API

Made on 🌍 by a Human

About The Project

This is a REST API code that has been implemented using the Express.js framework.

The API listens to incoming HTTP POST requests on the endpoint "/check-for-swear-words" and takes in a JSON request body that has a single property "text", which is a string that needs to be checked for the presence of swear words.

Core Features

The API returns a JSON response containing two properties:

  • "containsSwearWord": A boolean value indicating whether the input string contained a swear word.
  • "swearWord": A string that contains the first swear word found in the input string.

Instructions for using the API

If the above API doesn't work, use this one instead 👇

Example :

const fetch = require("cross-fetch");

fetch(
  "https://noswearwordsapi-production.up.railway.app/check-for-swear-words",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ text: "It's not okay to use the word fuck" }),
  }
)
  .then((response) => response.json())
  .then((data) => {
    console.log(data);
  })
  .catch((error) => {
    console.error(error);
  });

Response :

{ containsSwearWord: true, swearWord: 'fuck' }

Built With

Here's a curated list of all the major technologies that have been used to build This API:

  • Express : For implementing the API's Backend.
  • JavaScript : As a primary Programming Language.
  • Set : A built-in JavaScript data structure that is used to store the list of swear words in memory.
  • JSON : Use to send and receive data in a structured format.
  • HTTP : To use HTTP methods like POST to accept and process incoming requests and HTTP status codes to communicate the outcome of the request.