All Projects → openbrewerydb → openbrewerydb-rails-api

openbrewerydb / openbrewerydb-rails-api

Licence: MIT license
Official v1 Open Brewery DB REST API built with Ruby on Rails

Programming Languages

HTML
75241 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to openbrewerydb-rails-api

Go Relax
Framework for building RESTful API's in Go
Stars: ✭ 155 (+811.76%)
Mutual labels:  api-rest
Rails Api Base
Rails 5 RESTful api template
Stars: ✭ 197 (+1058.82%)
Mutual labels:  api-rest
nestjs-api-mongoose
Collection example apps with NestJS and Typeorm, Sequelize, Mongodb, PostgreSQL, MySQL, GraphQL, Mercurius, etc. for the NestJS community 😻
Stars: ✭ 153 (+800%)
Mutual labels:  api-rest
Sqler
write APIs using direct SQL queries with no hassle, let's rethink about SQL
Stars: ✭ 1,943 (+11329.41%)
Mutual labels:  api-rest
Js Client
A Open-API derived JS + Node.js API client for Netlify
Stars: ✭ 170 (+900%)
Mutual labels:  api-rest
Api on rails
Learn best practices to build an API using Ruby on Rails 5/6
Stars: ✭ 236 (+1288.24%)
Mutual labels:  api-rest
Evomaster
A tool for automatically generating system-level test cases. Currently targeting REST APIs.
Stars: ✭ 151 (+788.24%)
Mutual labels:  api-rest
smockin
Dynamic API, S3 & Mail mocking for web, mobile & microservice development.
Stars: ✭ 74 (+335.29%)
Mutual labels:  api-rest
Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (+964.71%)
Mutual labels:  api-rest
Webhookd
A very simple webhook server launching shell scripts.
Stars: ✭ 250 (+1370.59%)
Mutual labels:  api-rest
Aurora Api Project
Aurora is a project developed in .NET Core, where it aims to show how to create something using an architecture, in layers, simple and approaching, in a simplistic way, some concepts such as DDD.
Stars: ✭ 162 (+852.94%)
Mutual labels:  api-rest
Webgo
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).
Stars: ✭ 165 (+870.59%)
Mutual labels:  api-rest
Coinapi Sdk
SDKs for CoinAPI
Stars: ✭ 238 (+1300%)
Mutual labels:  api-rest
Reactive Ms Example
An educational project to learn reactive programming with Spring 5
Stars: ✭ 157 (+823.53%)
Mutual labels:  api-rest
api sof
Tutorial para acessar a API do Sistema de Orçamento e Finanças _SOF da cidade de São Paulo, utilizando Python e a biblioteca Pandas, realizar análises e salvar arquivo CSV/Excel
Stars: ✭ 31 (+82.35%)
Mutual labels:  api-rest
Appkernel
API development made easy: a smart Python 3 API framework
Stars: ✭ 152 (+794.12%)
Mutual labels:  api-rest
Serverest
APIs REST simulando loja virtual para servir de estudo de testes de API de forma manual ou automatizada
Stars: ✭ 223 (+1211.76%)
Mutual labels:  api-rest
laravel5-jokes-api-with-jwt-and-pagination
Laravel5 Full Fledged API with JWT auth
Stars: ✭ 15 (-11.76%)
Mutual labels:  api-rest
rest-api
Laravel restfull api boilerplate
Stars: ✭ 57 (+235.29%)
Mutual labels:  api-rest
Hotels server
酒店预订系统后台管理系统
Stars: ✭ 249 (+1364.71%)
Mutual labels:  api-rest

🍻 Official Open Brewery DB REST API Server

Open Brewery DB Logo

Github Actions Badge

The Open Brewery DB API server is a Ruby on Rails app connected to a PostgreSQL DB server served at https://api.openbrewerydb.org.

Documentation

📦 Dependencies

  • Ruby 3.2.0
  • PostgreSQL 14.2
  • Elastic Search (See Searchkick's Getting Started section.) Note: Elastic Search is likely to be removed in the future.

🚀 Getting Started

Local Environement

  1. Clone the repo $ git clone https://github.com/openbrewerydb/openbrewerydb-rest-api
  2. Run bundle install
  3. Run bundle exec rails db:setup
  4. Run database import. See Data Import Task
  5. Run bundle exec rails s

The server will be running at http://localhost:3000

Updating

NOTE: Don't forget to use bundle lock --add-platform x86_64-linux after updating bundle!

Database Expectations

There are some assumptions for the local PostgreSQL service configuration.

  • Host is localhost or 127.0.0.1
  • User is blank (i.e. it is the current system user)
  • Password is blank

All of these settings can be overwritten by setting environment variables in .env:

  • POSTGRES_USER
  • POSTGRES_PASSWORD
  • POSTGRES_HOST

See config/database.yml for configuration.

Data Import task

Using Rake, we can import the brewery data with a simple command.

rake breweries:import:breweries

This command will update your existing database in the development environment with new breweries. We also allow you to set environment variables to determine how to run the task.

  • RAILS_ENV=[development, test]
  • TRUNCATE=[true, false]
  • DRY_RUN=[true, false]

Prerequisites

You will need to have your postgresql server running as well as the ElasticSearch container. ElasticSearch is required for the autocompletion and fuzzy searching functionalities.

#start postgresql server
sudo service postgresql start

#pull and start elasticsearch container
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.12.1
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.12.1

Additionally, these commands will not run Geocode or index fields with searchkick. These have their own rake tasks and will need to be run manually if you would like to use their functionality.

#geocode
rake geocode:all CLASS=Brewery RAILS_ENV=[development, test] BATCH=100

#searchkick
rake searchkick:reindex CLASS=Brewery RAILS_ENV=[development, test]

Note! The geocode task takes an extraordinary amount of time. Do not run this task unless you require it. You should also use the BATCH env so you do not run out of memory.

Update

Updating is the default task. This should be run if you wish to only update your existing database.

Fresh import

This option will truncate your breweries table to make sure it's clean and then add all breweries. This will also bypass all validations as it's inserting by direct SQL commands.

rake breweries:import:breweries TRUNCATE=true RAILS_ENV=[development, test]

Adding data manually

Importing data can also be done manually if you grab the data from openbrewerydb.

  • Open postgresql shell with psql <your user>
  • \c openbrewerydb_development to connect to the database
  • Make sure the breweries table exists. \dt
  • Copy the data to the table: \copy breweries(obdb_id,name,brewery_type,street,address_2,address_3,city,state,county_province,postal_code,website_url,phone,created_at,updated_at,country,longitude,latitude,tags) from '<path to CSV data file>' DELIMITER ',' CSV HEADER
  • Run SELECT * FROM breweries LIMIT 10; to make sure data loaded

Running Tests

bundle exec rake or bundle exec rspec

🤝 Contributing

For information on contributing to this project, please see the contributing guide and our code of conduct.

🔗 Related

👾 Community

📫 Feedback

Any feedback, please email me.

Cheers! 🍻

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].