Skip to content

Pencil Backend Application - NodeJS + Express based server

License

Notifications You must be signed in to change notification settings

tosinbot/realtime-notes-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Realtime Notes Backend

The goal of this assignment is to store and create an index over question objects in MongoDB, and write a NodeJS + Express based server that exposes a RESTful API to query the index and return questions that match the query.

Built With

  • Node
  • MongoDB

Installation

  1. Clone the repo
    git clone https://github.com/tosinbot/realtime-notes-backend.git
  2. Install NPM packages
    npm install
  3. Setup env file by renaming .env.example to .env
   PORT=Preferred_Port_Number
   MONGODB_URL="db_type://username:password@hostname:port/database_name"
  1. Start mongodb with mongod
  2. Start the server with npm start

Endpoints available

Endpoints Method Description
/search?q=name of topic GET returns an array of question numbers that contain an annotation which is anywhere in the subtree of the query topic

Integration

Frontend application built with Angular can be found here - https://github.com/tosinbot/realtime-notes-app

Hosted sample App

The app is hosted on Heroku

Example Usage

To query the database make a get request to the route https://tosin-pencil.herokuapp.com/api/v1/search?q=<name of topic>

Example 1:

https://tosin-pencil.herokuapp.com/api/v1/search?q=Reproduction should return

{
    "questions": [
       29,48,58,176,181,7,53,54,73,69,158,182,37,52,109,49,122,3,25,193,125,133,12,45,138,187,56,153,190,15,130,167,197]
}
Example 2:

https://tosin-pencil.herokuapp.com/api/v1/search?q=Molecular Genetics should return

{
    "questions": [
       31,79,107,150,162,126,144]
}
Example 3:

https://tosin-pencil.herokuapp.com/api/v1/search?q=Molecular Genetics should return

{
    "questions": [
       31,79,107,150,162,126,144]
}

About

Pencil Backend Application - NodeJS + Express based server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published