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").
- 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"
-
POST /strings
- Body:
{ "string": "..." } - Creates a new string entry
- Body:
-
GET /strings
- Query params:
string,minLength,contains_character,is_palindrome - Returns a list of stored strings matching the filters
- Query params:
-
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 stringsq=strings longer than 10 charactersq=single word strings
- Natural-language filtering route. Examples:
From the stage1 folder run:
npm installStart the server (default port configured in package.json or your setup):
npm startCreate 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"- The
.gitignorealready excludes.envandnode_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.jsto accept more natural-language variants as needed.
Add your preferred license (e.g. MIT) in this file if you plan to publish the project.