Code Monkey home page Code Monkey logo

findhousesapi's Introduction

Find Your House Backend

This is a back-end API, which provides data to this application that I developed.

Tracking app

This repo is an Api for a project to find houses to buy or to rent. It has a scrolling for better user experience in mobiles. It has differents interactive element like a toogle to see the navigation and the user Info. You can add to favorite the houses you like and change the selection of houses only to your favorites. It has a full functional login system and protected routes, so only a login user can enter the dashboard.

Features:

  • Create a new user
  • Require authentication for login
  • Filter the password
  • Create and get houses
  • Add houses to favorites

Base URL for request

It's deployed here on heroku

Built With

This project was built using these technologies.

  • Ruby on Rails
  • rack-cors
  • GitHub
  • Rubocop
  • Stylelint
  • Eslint

Getting Started

To get a local copy up and running follow these simple example steps.

Clone

  • Clone this repo:
    • Clone with SSH:
      [email protected]:yahir91/FIndhousesApi.git
    
    • Clone with HTTPS
      https://github.com/yahir91/FIndhousesApi.git
    

Setup

Install dependencies:

$ bundle install

Start the local webserver:

$ rails s -p 4000 will open the project at local webserver at http://localhost:4000/

Using | Requests examples using JS with

for all request you will need base URL: const baseUrl = https://houses-api-yahir.herokuapp.com

Create New House

data = {
  title,
  description,
  rent,
  file
}
const url = `${baseUrl}/houses`;
const config = `{
    method: 'POST',
    mode: 'cors',
    headers: {
      'Content-Type': 'application/json',
      Authorization: ` Bearer ${token} `,
    },
    body: JSON.stringify(data),
  }`

Get all Houses

const url = `${baseUrl}/houses`;
const config = `{
    method: 'GET',
    mode: 'cors',
    headers: {
      Authorization: `Bearer ${token} `,
    }`

Get all Favorites Houses (Need to be log in)

const url = `${baseUrl}/favorites`;
const config = `{
    method: 'GET',
    mode: 'cors',
    headers: {
      Authorization: `Bearer ${token} `,
    }`

Get a House

const url = `${baseUrl}/houses/id`;
const config = `{
    method: 'GET',
    mode: 'cors',
    headers: {
      Authorization: `Bearer ${token} `,
    }`

Add house to favorite (Need to be log in)

data ={
  house: params[id]
}
const url = `${baseUrl}/favorites`;
const config = `{
    method: 'POST',
    mode: 'cors',
    headers: {
      Authorization: `Bearer ${token}`,
    }`,
    body: JSON.stringify(data), 

Remove house from favorite (Need to be log in)

const url = `${baseUrl}/favorites/id`;
const config = `{
    method: 'DELETE',
    mode: 'cors',
    headers: {
      Authorization: `Bearer ${token}`,
    }`,

Create User and Session (Sing up)

data = {
  email,
  name,
  password,
  password_confirmation
}
const url = `${baseUrl}/users/sign_up`;
const config = `{
    method: 'POST',
    mode: 'cors',
    headers: { 'Content-Type': 'application/json' },
    redirect: 'follow',
    body: JSON.stringify(data),
  },`

Create Session (Login)

data = {
  email,
  password
}
const url = `${baseUrl}/users/sign_in`;
const config = `{
    method: 'POST',
    mode: 'cors',
    headers: { 'Content-Type': 'application/json' },
    redirect: 'follow',
    body: JSON.stringify(data),
  }`

Destroy session (Sing out, Need to be log in )

const apiUrl = `${baseUrl}/users/sign_out`;
const config = `{
    method: 'DELETE',
    mode: 'cors',
    headers: { 'Content-Type': 'application/json' },
    redirect: 'follow',
  }`

Authors

๐Ÿ‘ค Yahir Cardona

Working as a FullStack developer on this project.

Website

LINKEDIN

Show your support

Give a โญ if you like this project!

๐Ÿ“ License

This project is MIT licensed.

findhousesapi's People

Contributors

yahir91 avatar

Stargazers

 avatar

Watchers

 avatar

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.