Skip to content

dunascode-prog/stringAnalyzer-API

Repository files navigation

stringAnalyzer API

A small Node.js + Express service for storing and querying strings. The API supports creating, listing, deleting strings and offers both parameter-based and natural-language filtering (e.g. "single word palindromic strings", "strings longer than 10 characters").

Features

  • Persist strings (simple storage via the project's model)
  • Create and delete string entries
  • Filter strings using query parameters (exact match, minLength, contains_character, is_palindrome)
  • Natural-language filtering endpoint that accepts human-readable queries like "single word palindromic strings" or "strings longer than 10 characters"

Endpoints

  • POST /strings

    • Body: { "string": "..." }
    • Creates a new string entry
  • GET /strings

    • Query params: string, minLength, contains_character, is_palindrome
    • Returns a list of stored strings matching the filters
  • DELETE /strings/:string

    • Deletes the specified string (by exact match)
  • DELETE /strings

    • Deletes all strings
  • GET /strings/filter-by-natural-language?q=...

    • Natural-language filtering route. Examples:
      • q=all palindromic strings
      • q=strings longer than 10 characters
      • q=single word strings

Install

From the stage1 folder run:

npm install

Run

Start the server (default port configured in package.json or your setup):

npm start

Examples (PowerShell)

Create a string:

Invoke-RestMethod -Method Post -Uri "http://localhost:3000/strings" -ContentType 'application/json' -Body ('{ "string": "racecar" }')

Natural-language filter:

Invoke-RestMethod -Method Get -Uri "http://localhost:3000/strings/filter-by-natural-language?q=single word palindromic strings"

Traditional filter:

Invoke-RestMethod -Method Get -Uri "http://localhost:3000/strings?minLength=5"

Notes

  • The .gitignore already excludes .env and node_modules/ to keep secrets and heavy dependencies out of the repo.
  • The natural-language parser supports a limited set of patterns (palindrome, longer/shorter than N, single/multiple words). Extend the parser in stringController.js to accept more natural-language variants as needed.

License

Add your preferred license (e.g. MIT) in this file if you plan to publish the project.

About

Node.js/Express StringAnalyzer API for string operations (store, filter, palindrome checks).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published