In the United States alone, we generate about 300 million tons of solid waste in just a year. Half of that amount goes straight to the landfill, where it is stored. The landfill is more or less a static environment - when a landfill is overcapacity, it’s sealed off with liner to prevent leakage. The trash continues to decompose underneath, generating many byproducts such as leachate which is contaminated rainwater, and carbon monoxide from bacteria which contributes to rising CO2 levels in our air. Even worse, 15% of landfill trash is actually compostable, reusable and recyclable. How do we, as long-term residents of earth, reduce this waste?
GreenEarth is an interactive and collaborative website where people can find creative projects, posted by other members of the community, that utilize common household trash and repurpose them into useful household items or cool art projects.
Download source and run npm install
to install dependencies and npm start
to start local server at http://localhost:3000.
To connect to a Redis Cloud Enterprise Database with RedisJSON enabled, edit the following code in index.js
.
const client = redis.createClient({
port : // database port,
host : // database url,
password : // database password
});
Creates user account.
SADD
- Adds username to global users set
HMSET
- Creates user object with information including hashed password, description and profile picture
Logs into existing account.
SISMEMBER
- Checks if entered username is valid member of global users set
HGET
- Retrieves registered user password to validate with entered password
HSET
- Adds username with generated session token to active user group br>
Logs out of signed in account.
HGET
- Retrieves user from provided session token
HDEL
- Removes user and session token from active user group
Retrieves information (username, description, profile picture) of specified user.
HMGET
- Retrieves user data from provided attributes
Sets specific attributes (description, profile picture) of specified user.
HMSET
- Sets user attributes with provided data
Adds a post from provided user information.
HGET
- Retrieves user post list ID
JSON.SET
- Creates post from provided information ands add to user post list
JSON.GET
- Retrieves user post list
Edits existing post created by user.
HGET
- Retrieves user post list ID
JSON.SET
- Replaces existing post with new post from provided information in user post list
JSON.GET
- Retrieves user post list
Deletes existing post created by user.
HGET
- Retrieves user post list ID
JSON.SET
- Removes post ands add to user post list
JSON.GET
- Retrieves user post list
Retrieves information (title, description, image, materials, directions, comments) of specified post.
JSON.GET
- Retrieves post from user post list
Retrieves all global posts or those created by specific user.
JSON.GET
- Retrieves user or global post list
Retrieves all drafts created by user.
JSON.GET
- Retrieves user draft list
Adds a comment to post created by user.
HGET
- Retrieve post comment list ID
JSON.SET
- Creates comment ands add to post comment list
JSON.GET
- Retrieves post comment list