Skip to content

Escape NYC is a web application that will allow users to submit hiking trails that they have found to help encourage New Yorkers to leave the city and get some fresh air during quarantine.

Notifications You must be signed in to change notification settings

Darnycya/Escape-NYC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Escape NYC

Escape NYC is a full CRUD React app that allows users to submit hiking trails that they have found to help encourage New Yorkers to leave the city and get some fresh air during quarantine. The API that is being edited on the application is: here.

Link To Escape NYC

Click Here

Sample of API

{
      "name": "Anthony's Nose",
      "trailUrl": "https://hikethehudsonvalley.com/wp-content/uploads/2015/05/Spring2014_RWAN_955.jpg",
      "difficulty": "Medium",
      "distanceFromNyc": 40,
      "climbingTime": 2.5,
      "rating": 4
    }

Sample of the CRUD Frunctionality

import axios from 'axios'

const apiUrl = `https://escape-nyc-api-0c842ac3c094.herokuapp.com`

export const getTrails = async () => {
  try {
    const response = await axios(`${apiUrl}/trails`)
    const trails = response.data
    return trails
  } catch (error) {
    throw error
  }
}

export const getTrail = async id => {
  try {
    const response = await axios(`${apiUrl}/trails/${id}`)
    const trail = response.data
    return trail
  } catch (error) {
    throw error
  }
}

export const createTrail = async trail => {
  try {
    const response = await axios.post(`${apiUrl}/trails`, trail)
    return response.data
  } catch (error) {
    throw error
  }
}

export const updateTrail = async (id, trail) => {
  try {
    const response = await axios.put(`${apiUrl}/trails/${id}`, trail)
    return response.data
  } catch (error) {
    throw error
  }
}

export const deleteTrail = async id => {
  try {
    const response = await axios.delete(`${apiUrl}/trails/${id}`)
    return response.data
  } catch (error) {
    throw error
  }
}

About

Escape NYC is a web application that will allow users to submit hiking trails that they have found to help encourage New Yorkers to leave the city and get some fresh air during quarantine.

Topics

Resources

Stars

Watchers

Forks