Git Product home page Git Product logo

cs-api's Introduction

Requirements

  • Node 18
  • Docker

Build

Build the Docker containers.

$ docker-compose build

Running the app

Run the Docker containers.

$ docker-compose up

Remove containers

Remove the Docker containers.

$ docker-compose down

API Documentation

Access the API documentation at: http://localhost:3000/swagger

Mongo Express

Access the Mongo Express at: http://localhost:8081 user: admin pwd: pass

Database Seeding

Seed the database with dummy data.

$ curl -X 'POST' \
  'http://localhost:3000/seeds' \
  -H 'accept: */*' \
  -d ''

Get Users

Retrieve the list of users.

$ curl -X 'GET' \
  'http://localhost:3000/users' \
  -H 'accept: */*'

Get Distance

Find the relationship distance between two users.

$ curl -X 'GET' \
  'http://localhost:3000/users/relationship/65c294e205e3809016ba9efc/65c294e205e3809016ba9f07' \
  -H 'accept: */*'

Sample Response:
  {
  "distance": 2,
  "users": [
    {
      "_id": "65c294e205e3809016ba9efc",
      "name": "Chad Phillips",
      "friends": [
        "65c294e205e3809016ba9f1f",
        "65c294e205e3809016ba9f13",
        "65c294e205e3809016ba9f59",
        "65c294e205e3809016ba9f5e",
        "65c294e205e3809016ba9f15",
        "65c294e205e3809016ba9f1e",
        "65c294e205e3809016ba9f2c",
        "65c294e205e3809016ba9f39",
        "65c294e205e3809016ba9f3a",
        "65c294e205e3809016ba9f55"
      ],
      "__v": 0
    },
    {
      "_id": "65c294e205e3809016ba9f07",
      "name": "Genevieve Figueroa",
      "friends": [
        "65c294e205e3809016ba9f3a",
        "65c294e205e3809016ba9f01",
        "65c294e205e3809016ba9f0b",
        "65c294e205e3809016ba9f10",
        "65c294e205e3809016ba9f2d",
        "65c294e205e3809016ba9f32",
        "65c294e205e3809016ba9f3c",
        "65c294e205e3809016ba9f55"
      ],
      "__v": 0
    }
  ]
}

Quick Demo

cs-api's People

Contributors

alpdogan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.