Giter Club home page Giter Club logo

chijiokeorabueze / lekki_property_api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 71 KB

This is an dockerized API application built with the ruby on rails framework. It exposes 3 endpoints for creating, updating and fetching real estate properties. It uses ruby service methods, dry validation and validates property address. The specifications of the endpoints was documented using the swagger editor.

License: MIT License

Dockerfile 0.59% Ruby 98.60% HTML 0.81%
docker docker-compose httparty postgres rails rails-api ruby

lekki_property_api's Introduction

LEKKI PROPERTY API

This is the Lekki property API. An API application built with ruby on the rails framework. It exposes 3 endpoints for creating, updating and fetching real estate properties. The specifications of these endpoints are documented with the swagger editor and hosted at "https://chijiokeorabueze.github.io/Lekki_Property_Api_Spec/". In addition, the raw file of this documentation can be found in at public/lekki_properties_api.yaml. This can be viewed and edited by importing the file to a swagger editor ("https://editor.swagger.io/").

  • Ruby version - 3.1.4
  • Rails version - 7.0.5

SYSTEM DEPENDENCIES

The only real dependency of this application is docker and docker-compose. This is because the application was built and contanerized with docker and docker-compose. This implies that running the application will require a computer capable of virtualization with an installation of both docker and docker-compose. visit the docker page "https://www.docker.com/" to download and install these tools if they are not yet installed.

THIRD PARTY API'S

This application uses the Geoapify Geocoding API for address validation. Running the application will require setting up a Geoapify account and getting an api key. To do this visit the geopify website "https://www.geoapify.com/pricing" sign up for the free account and create a project. This will give an api key for making api calls. This value will be configured as part of the environment variables.

CONFIGURATION

Configurations to be carried before running this application includes setting up the database environment variables. This can be done in the .env file. For development, The application comes with an embedded postgres database which runs as a seperate container. In addition to this, the API key for the Geoapify Geocoding service also needs to be set.

The list of environment variables to set includes the following:

  1. DB_HOST => This is the database host name. It should be the name of the database container outlined in the docker-compose file (for dev environment). It defaults to "localhost" if not provided.

  2. DB_USERNAME => The user name of database to connect with for dev environment. Defaults to the current set username of the docker compose file.

  3. DB_PASSWORD => The password of database to connect with for dev environment. Defaults to the current set password on the docker compose file.

  4. DB_PORT => The port of database to connect to. Defaults to 5432 for all environments.

  5. DB_DEV => Data base name for dev server. Defaults to a preset name if not provided.

  6. DB_NAME => Data base name for production server. Defaults to a preset name if not provided.

  7. LEKKI_PROPERTY_API_DATABASE_USERNAME => Database username for production server. Must be provided when running production server.

  8. LEKKI_PROPERTY_API_DATABASE_PASSWORD => Database password for production server. Must be provided when running production server.

  9. GEOPIFY_API_KEY => Geopify api key for address validation.

DATABASE CREATION AND INITIALIZATION

Once these variables has been set. The database can either be created manually or by running docker-compose run api rake db:create on a terminal at the root directory fo this project. After this is done, run docker-compose run api rake db:migrate to run data migrations and initialize the database.

STARTING THE APPLICATION

To start the application simply run docker-compose up on a terminal at the root directory fo this project. This will start the application on "http://localhost:3000". Proceed to make requests with "/api/v1" attached to the base url e.g "http://localhost:3000/api/v1/properties"

lekki_property_api's People

Contributors

chijiokeorabueze 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.