Skip to content

miracle-mm/back-end

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Miracle Messages Map v1.0.0

View Interactive Miracle Messages Map API Docs

Homeless

DELETE /api/homeless/:id

DELETE /api/homeless/:id

Parameters

Name Type Description
id id

User Id (comes from URL)

Examples

Request

axios.delete('/api/homeless/:id');

Success Response

Response

HTTP/1.1 204 No Content

PUT /api/homeless/:id

PUT /api/homeless/:id

Parameters

Name Type Description
id id

Required User Id (comes from URL)

name string optional

Optional updated Homeless Name

email string optional

Optional updated Homeless Email

city string optional

Optional updated Homeless City

state string optional

Optional updated Homeless State

country string optional

Optional updated Homeless Country

longitude float optional

Optional updated Homeless Longitude

latitude float optional

Optional updated Homeless Latitude

Examples

Request

axios.put('/api/homeless/:id', updatedHomeless);

Success Response

Response

{
      "id": 2,
      "firstName": "Joel",
      "lastName": "Perez",
      "city": "Lafayette",
      "state": "CO",
      "zip": null,
      "country": "United States of America",
      "created": 1564524174115,
      "longitude": -105.097455,
      "latitude": 39.994962
  } *

GET /api/homeless

GET /api/homeless

Headers

Name Type Description
token string

Token returned from login passed in as req.headers.authorization

Examples

Request

axios.get('/api/homeless');

Success Response

Response

[
       {
           "id": 14,
           "firstName": "McClure",
           "lastName": "Daley",
           "longitude": -121.806,
           "latitude": 38.0049
       },
       {
           "id": 15,
           "firstName": "Edmondson",
           "lastName": "Africa",
           "longitude": -122.198,
           "latitude": 37.4613
       }
   ]

GET /api/homeless/:id

GET /api/homeless/:id

Headers

Name Type Description
token string

Token returned from login passed in as req.headers.authorization

Parameters

Name Type Description
id id

User Id (comes from URL)

Examples

Request

axios.get('/api/homeless/:id');

Success Response

Response

{
      "id": 2,
      "firstName": "Joel",
      "lastName": "Perez",
      "city": "Lafayette",
      "state": "CO",
      "zip": null,
      "country": "United States of America",
      "created": 1564524174115,
      "longitude": -105.097455,
      "latitude": 39.994962
  }

POST /api/homeless

POST /api/homeless

Parameters

Name Type Description
firstName string

Mandatory First Name

lastName string

Mandatory Last Name

city string optional

Optional city

state string optional

Optional state

zip string optional

Optional zip code

country string optional

Optional country

longitude float optional

Optional longitude

latitude float optional

Optional latitude

Examples

Request

axios.post('/api/homeless', newHomelessPerson);

Success Response

Response

{
      "id": 2,
      "firstName": "Joel",
      "lastName": "Perez",
      "city": "Lafayette",
      "state": "CO",
      "zip": null,
      "country": "United States of America",
      "created": 1564524174115,
      "longitude": -105.097455,
      "latitude": 39.994962
  }

Partners

DELETE /api/partners/:id

DELETE /api/partners/:id

Parameters

Name Type Description
id id

User Id (comes from URL)

Examples

Request

axios.delete('/api/partners/:id');

Success Response

Response

HTTP/1.1 204 No Content

PUT /api/partners/:id

PUT /api/partners/:id

Parameters

Name Type Description
id id

Required User Id (comes from URL)

name string optional

Optional updated Partner Name

email string optional

Optional updated Partner Email

city string optional

Optional updated Partner City

state string optional

Optional updated Partner State

country string optional

Optional updated Partner Country

longitude float optional

Optional updated Partner Longitude

latitude float optional

Optional updated Partner Latitude

Examples

Request

axios.put('/api/partners/:id', updatedPartner);

Success Response

Response

{
    "id": 447,
    "name": "Joels food bank",
    "email": "[email protected]",
    "city": "Denver",
    "state": "CO",
    "country": "USA",
    "longitude": -104.988415,
    "latitude": 39.749885,
    "password": "$2a$10$l1AbQFAGX.CZOEQm1RgaP.qVstDpteUXm2XuqhT9q280KMnQDQYxi"
}

GET /api/partners

GET /api/partners

Examples

Request

axios.get('/api/partners');

Success Response

Response

[
   {
           "id": 1,
           "name": "Nicole Zaborsky",
           "email": "[email protected]",
           "longitude": -119.9843482,
           "latitude": 38.9332411
      },
      {
           "id": 2,
           "name": "Jill Baker",
           "email": "[email protected]",
           "longitude": -76.4321089,
           "latitude": 36.9786449
       }
   ]

GET /api/partners/:id

GET /api/partners/:id

Parameters

Name Type Description
id id

User Id (comes from URL)

Examples

Request

axios.get('/api/partners/:id');

Success Response

Response

{
    "id": 447,
    "name": "Joels food bank",
    "email": "[email protected]",
    "city": "Denver",
    "state": "CO",
    "country": "USA",
    "longitude": -104.988415,
    "latitude": 39.749885,
    "password": "$2a$10$l1AbQFAGX.CZOEQm1RgaP.qVstDpteUXm2XuqhT9q280KMnQDQYxi"
  }

POST /api/auth/login

POST /api/auth/login

Parameters

Name Type Description
email string

Mandatory email

password string

Mandatory password

Examples

Request

axios.post('/api/auth/login');

Success Response

Response

{
    "id": 447,
    "name": "Joels food bank",
    "email": "[email protected]",
    "city": "Denver",
    "state": "CO",
    "country": "USA",
    "longitude": -104.988415,
    "latitude": 39.749885,
    "password": "$2a$10$l1AbQFAGX.CZOEQm1RgaP.qVstDpteUXm2XuqhT9q280KMnQDQYxi"
  }

POST /api/auth/register

POST /api/auth/register

Parameters

Name Type Description
name string optional

Optional name

email string

Mandatory email

password string

Mandatory password

city string optional

Optional city

state string optional

Optional state

country string optional

Optional country

longitude float optional

Optional longitude

latitude float optional

Optional latitude

Examples

Request

axios.post('/api/auth/register');

Success Response

Response

{
    "id": 447,
    "name": "Joels food bank",
    "email": "[email protected]",
    "city": "Denver",
    "state": "CO",
    "country": "USA",
    "longitude": -104.988415,
    "latitude": 39.749885,
    "password": "$2a$10$l1AbQFAGX.CZOEQm1RgaP.qVstDpteUXm2XuqhT9q280KMnQDQYxi"
  }

Site working at: https://miraclemessages.netlify.com

mm

About

NodeJS back end and documentation page for Miracle Messages Map

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •