Coder Social home page Coder Social logo

davees987 / buy-nothing-backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 401-javascript-final-drjs/buy-nothing-backend

0.0 0.0 0.0 1.21 MB

This is the backend repository for our buynothing app.

Home Page: https://buynothing-frontend.netlify.app/main

License: MIT License

JavaScript 100.00%
mongodb nodejs expressjs javascript rest-api

buy-nothing-backend's Introduction

Buy Nothing Back End

Inspired by Buy Nothing. A web application for giving things away for free or finding things for free. This is the back-end server for buynothing.netlify.app

Contributors: Davee Sok, Ryan Geddes, Sarah Shatto, Jonathon Lee.

Version

Links and Resources

Overview

This server performs crud operations on a listings collections and images collections. Certain routes can require authentication and authorization priveleges.

Architecture

  • The server uses an express framework and is deployed through heroku.
  • MongoDB is used to store listings information and image urls.
  • Actual images are not stored in our database, but a middleware in the image route, sends images to Cloudinary, and saves the url to our database.
  • Passwords are not stored in our database but handled through Auth0 on the frontend application.

Dependencies and Tools

JavaScript

Node.js

Express.js

Mongo

Cloudinary



Javascript ➡ NodeJS ➡ ExpressJS ➡ MongoDB ➡ Cloudinary 

Setup

  • Clone down this repo
  • Make sure MongoDB is installed on your computer
  • Install dependencies: npm install
  • Create an account at https://cloudinary.com/ and get the following:
    • Cloud Name
    • API key
    • API secret
  • Add the following into an .env file:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/buy-nothing-backend
SECRET= ** pick a word, must match front end secret word. this is used to authenticate a token
CLOUD_NAME=  <<Get from Cloudinary Account>>
API_KEY= <<Get from Cloudinary Account>>
API_SECRET= <<Get from Cloudinary Account>>
  • If you want a database in the cloud
    • Go to https://www.mongodb.com/
    • Create New project
    • Create new cluster
    • replace MONGODB_URI with the address mongo gives you
  • Run the server: nodemon index.js

How to use this server:

The following routes are available:

api/v1/listings
api/v1/imghandler/images
api/v1/imghandler/upload

api/v2/listings
api/v2/imghandler/images
api/v2/imghandler/upload

Schema:

const listings = mongoose.Schema({
  title: { type: String, required: true },
  description: { type: String, required:true },
  imageUrl: { type: String, required:true },
  creatorUserName: { type: String, required:true },
  creatorUserId: { type: String, required:true },
  categories: { type: String, required:true },
  location:{ type: String, required:true },
  itemStatus: { type: Boolean, required:true },
  comments:[],
  commentors: [],
});

Tests

in progress... no tests at this time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.