Skip to content

nowamey/capstoneweedwarriors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weed Warriors

Frontend for a reporting system where users collaboratively map instances of local invasive plant species.

Prerequisites

This project requires NodeJS and NPM.

To make sure you have them available on your machine, try running the following command.

$ npm -v "&&" node -v
8.11.0
v16.16.0

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Installation

Start with cloning this repo on your local machine:

$ git clone https://github.com/nurulhaya/weedwarriors.git
$ cd weedwarriors

To install and set up the library, run:

$ npm install 

Usage

Serving the app

$ npm start

API

Data catalog

  • GET /api/catalog - Current data catalog entries in the database.
  await fetch("/api/catalog");

Severity

  • GET /api/severity - Current severity category entries in the database.
  await fetch("/api/severity");

Media

  • GET /api/media - Current media entries in the database.
  await fetch("/api/media");
  • POST /api/media - Create a new media entry, requires url in request body. Example:
  await fetch("/api/media", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      url: 'https://site.com/example.png',
    }),
  })
    .then((res) => res.json())
    .then((json) => console.log(json));

Users

  • GET /api/users - Current user entries in the database.
  await fetch("/api/users");
  • POST /api/users - Create a new user entry, requires first name, last name, and email in request body. Example:
  await fetch("/api/users", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      first_name: 'First',
      last_name: 'Last',
      email: '[email protected]',
    }),
  })
    .then((res) => res.json())
    .then((json) => console.log(json));

Reports

  • GET /api/reports - Current report entries in the database.
  await fetch("/api/reports");
  • POST /api/reports - Create a new report entry. Example:
  await fetch("/api/reports", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      catalog_id: 1,
      location: '(31.007027, -73.922880)',
      severity_id: 1,
      media_id: 1,
      comments: 'N/A',
      user_id: 1,
    }),
  })
    .then((res) => res.json())
    .then((json) => console.log(json));

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •