Skip to content
API and backend for the Neighborhood Connect project
JavaScript TSQL
Branch: dev
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
configs
migrations
server
.eslintrc.json
.gitignore
README.md
app.js
database.json
docker-compose.yml
ncbu.sql
package-lock.json
package.json
visualization.png

README.md

neighborhood-connect-api

API and backend for the Neighborhood Connect project

Table of Contents

Getting Started

  • Run npm i from the command line
  • copy the file at /server/model/config.example.js -> config.js and fill in the password and host information
  • Run npm start

Requirements

To get this project setup, you will need:

Getting Up and Running

cd neighborhood-connect-api

In a seperate command terminal window, run:

docker-compose up

Switch back to your main terminal and run:

npm install
npm run dev-db-refresh
npm start

Database

Configuration

The database connection configuration is managed in file:

./server/model/config.js

The config file points to the local dev DB by default.

Local Development DB

This project uses a Docker container to host the local Postgres database. To start it up, open a command terminal and run:

docker-compose up

You will need to install Docker and Docker Compose if you don't have them already. If you already have Postgres installed and running on your computer, you may need to stop it's service before spinning up the dockerized database so that the ports don't conflict

sudo service postgresql stop

Once the database is up and running, you can generate the schema and populate it with test data using the db migrations.

DB Migrations

The database is versioned using db-migrate. To generate the database schema and populate it, with the test data, run:

npm run dev-db-refresh

The database connection configuration is managed in file:

./database.json

The file points to the local dev DB in Docker by default.

Database Schema

Schema

Schema Table

Back to table of Contents

API Endpoints

Priorities

Endpoint METHOD Description Completed
/priorities GET All priorities X
/priorities POST Add new priority
/priorities PATCH Update priority
/priorities/:priority_id GET Single priority
/priorities/:priority_id/actions GET All actions for a priority X
/priorities/orgs/:org_id GET All priorities by org X
/priorities/orgs/:org_id/:dist_id GET Single priorities by org X
/priorities/types/:type_id GET All priorities by type
/priorities/dist/:district_id GET All priorities by district

Priority Types

Endpoint METHOD Description Completed
/types GET X
/types/:type_id GET X

Actions

NEEDS REVIEW FOR NAMING | Endpoint | METHOD | Description | Completed | |:-|:-|:-|:-| | /actions | GET | | X | | /actions | POST | | X | | /actions/priorities/:priority_id | GET | | X | | /actions/types/:type_id | GET | | X | | /actions/:event_id | GET | | X |

Organizations

Endpoint METHOD Description Completed
/orgs GET X
/orgs POST X
/orgs PATCH
/orgs/:org_id GET X
/orgs/:org_id/users GET X
/orgs/:org_id/users/:user_id GET X
/orgs/:org_id/priorities GET
/orgs/:org_id/priorities/:priorities_id GET

Users

Endpoint METHOD Description Completed
/users GET X
/users POST
/users/:user_id PATCH
/users/:user_id GET X
/users/orgs/:org_id GET X

Back to table of Contents

Data requests and responses

Users Responses

/users

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/users/:user_id

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/users/orgs/:org_id

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/orgs

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/orgs/:org_id

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Method: PATCH

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/orgs/priorities

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/orgs/:org_id/priorities

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/orgs/:org_id/priorities/:priorities_id

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/orgs/:org_id/users

Method: POST

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/orgs/:org_id/users/:user_id

Method: PATCH

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Method: UPDATE

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Method: DELETE

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/priorities

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/priorities/type/:type_id

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/priorities/district/:disctrict_id

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/types

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/types/:type_id

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/events

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/events/priorities/:priority_id

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/events/types/:type_id

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

/events/:event_id

Method: GET

Structure of request

{

}

HTTP Status:

Structure of response:

{

}

Back to table of Contents

actions:

CRUD for:

  • priority
  • priority type
  • priority level
  • user
  • organization
  • organization type
  • event

Notes

Outstanding Design Questions

  • Should all requests but GET be directed to the path for that entity? ex: all non-Get requests regarding users is directed to users
You can’t perform that action at this time.