Coder Social home page Coder Social logo

organitza's Introduction

organitza

Track the organizations in your world.

This is an API that uses Hapi framework, JWT authentication and Lab tests.

Live Demo

Send HTTP requests to http://mysterious-chamber-36083.herokuapp.com using the information below.

API Documentation

Authorization

In order to request or send any data, you to send a JWT token as a header. Please contact Ben Margolis for a token.

Authorization: your_token_here

List organizations

GET /v1/organizations

Response: HTTP Status Code 200

[
    {
        "_id": "5bbcf9f859801305c1ee0e12",
        "name": "University of Rochester"
    },
    {
        "_id": "5bbcf9f859801305c1ee0e14",
        "name": "United Healthcare of Arizona"
    },
]

When you use code and/or name as parameters, the API filters by those parameters. It also returns the url and code of each organization.

GET /v1/organizations?code=UR

Response: HTTP Status Code 200

[
    {
        "_id": "5bbcf9f859801305c1ee0e12",
        "name": "University of Rochester",
        "code": "UR",
        "type": "health system",
        "url": "http://waterboy.com"
    }
]

GET /v1/organizations?name=University of Rochester

GET /v1/organizations?code=UR&name=University of Rochester

Create a new organization

type must be one of the following values: 'employer', 'insurance', 'health system'

name and code are required

POST /v1/organizations

{
    "name": "University of Rochester",
    "description": "U of R Health System",
    "code": "UR",
    "type": "health system",
    "url": "http://rochester.edu"
}

Response: HTTP Status Code 200

{
    "message": "success",
    "organization": {
        "_id": "5bbd3fd096362152d218fcde",
        "name": "University of Rochester",
        "description": "U of R Health System",
        "url": "http://rochester.edu",
        "code": "UR",
        "type": "health system"
    }
}

Update an organization

PUT /v1/organizations/${organizationID}

{
    "name": "University of Rochester",
    "description": "U of R Health System",
    "code": "UR",
    "type": "health system",
    "url": "http://rochester.edu"
}

Response: HTTP Status Code 200

{ message: 'success' }

Delete an organization

DELETE /v1/organizations/${organizationID}

Response: HTTP Status Code 200

{ message: 'success' }

Local Development

Copy the .env.example file to .env and fill in with the appropriate values for Mongo DB URL and JWT Secret.

To turn off JWT authentication, make JWT_SECRET an empty string.

You will need to set those same environment variables at your live servers.

To run:

node server.js

The above command will output the local URL. You can now use HTTP requests on endpoints on that URL.

To test:

source .env && node node_modules/lab/bin/lab -m 99999 tests/tests.js

The source .env makes sure the testing environment has all the environment variables it needs.

This repo is also a docker environment meant to be deployed to a Heroku container registry. See https://devcenter.heroku.com/articles/container-registry-and-runtime

organitza's People

Contributors

ben833 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.