API and backend for the Neighborhood Connect project
- Requirements
- Database
- Getting Started
- Database Tables
- API Endpoints
- Data requests and responses
- Notes
- 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
To get this project setup, you will need:
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
The database connection configuration is managed in file:
./server/model/config.js
The config file points to the local dev DB by default.
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.
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.
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 |
Endpoint | METHOD | Description | Completed |
---|---|---|---|
/types |
GET | X | |
/types/:type_id |
GET | X |
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 |
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 |
Endpoint | METHOD | Description | Completed |
---|---|---|---|
/users |
GET | X | |
/users |
POST | ||
/users/:user_id |
PATCH | ||
/users/:user_id |
GET | X | |
/users/orgs/:org_id |
GET | X |
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: PATCH
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: POST
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
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:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
Method: GET
Structure of request
{
}
HTTP Status:
Structure of response:
{
}
actions:
CRUD for:
- priority
- priority type
- priority level
- user
- organization
- organization type
- event
- Should all requests but GET be directed to the path for that entity? ex: all non-Get requests regarding users is directed to users