Skip to content

agile-learning-institute/mentorHub-search-api

Repository files navigation

mentorhub-search-api

Overview

This is a simple Typescript API that provides search results from the elasticsearch database. This API uses data from the mentorhub backing Elasticsearch Database.

The OpenAPI specifications for the API can be found in the docs folder, and are served here

Prerequisites

Contributing

The typescript files found in ./src/ are used to configure and start an API that will listen to requests on port 8081.

You can use Kibana Console to query the backing elasticsearch database.

Install dependencies

npm install

Compile Typescript code

npm run build

Run Jest Unit Tests

npm run test

Start the API locally

NOTE: This will down/up backing services

npm run start

Run the API locally

NOTE: This assumes backing services are running

npm run local

Build and run the container

NOTE: This will down/up backing services

npm run container

Just build the container

npm run precontainer

Run black box testing

NOTE: This assumes backing services and the API are running, either locally or in a container

npm run stepci

Run performance/load testing

NOTE: This assumes backing services and the API are running, either locally or in a container

npm run load

Local API Testing with CURL

In addition to the stepci API testing above, you can use regular curl commands to test the API.

Simple one word search

curl 'localhost:8081/api/search?search=curriculum'

Simple two word search

curl 'localhost:8081/api/search?search=inactive%20people'

Elasticsearch Query

NOTE: The query is a json object, so it has to be http url encoded. The query below uses this query object. { "match": { "lastName": "Smith" } }

curl 'localhost:8081/api/search?query=%7B%22match%22%3A%7B%22lastName%22%3A%22Smith%22%7D%7D'

Get API health

curl "http://localhost:8081/api/health/"

Get config information

curl "http://localhost:8081/api/config/"

About

A Typescript API that uses data from the backing Elasticsearch Database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 3

  •  
  •  
  •