/RESTFUL_API

Simple Node RESTful API

Primary LanguageTypeScript

RESTFUL API

Backend for a web application that allows users to load a CSV file with preformatted data and display the data as cards on the website.

Requirements

  • Upload a csv file
  • Search Users
  • Node RESTful API
  • Errors handling
  • Automated Tests

Endpoints

  • [POST /api/files] An endpoint that accepts a CSV file upload from the frontend and stores the data in a database or a data structure. You should use the key "file" in the body request.
  • [GET /api/users] Should include an endpoint that allows the frontend to search through the loaded CSV data. This route should accept a ?q= query parameter for search terms and should search through EVERY column of the CSV. The filter should search for partial matches and also be case insensitive.

How to configure the environment

  • Installing Node 18.x - LINK

Config and Run

npm install
npm run dev

Testing

  • Mocha
  • Chai
npm run test

CSV Data Example

The CSV file structure that will be used for testing the software should follow this format:

name,city,country,favorite_sport
John Doe,New York,USA,Basketball
Jane Smith,London,UK,Football
Mike Johnson,Paris,France,Tennis
Karen Lee,Tokyo,Japan,Swimming
Tom Brown,Sydney,Australia,Running
Emma Wilson,Berlin,Germany,Basketball