Frontend for a reporting system where users collaboratively map instances of local invasive plant species.
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
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
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
$ npm start
- GET
/api/catalog
- Current data catalog entries in the database.
await fetch("/api/catalog");
- GET
/api/severity
- Current severity category entries in the database.
await fetch("/api/severity");
- 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));
- 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));
- 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));