Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tostasqb/hl-backend
API that supports the website
https://github.com/tostasqb/hl-backend
Last synced: 30 days ago
JSON representation
API that supports the website
- Host: GitHub
- URL: https://github.com/tostasqb/hl-backend
- Owner: tostasqb
- Created: 2019-01-26T00:41:07.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-09T01:06:06.000Z (over 1 year ago)
- Last Synced: 2024-10-04T07:07:29.150Z (about 2 months ago)
- Language: Ruby
- Homepage: https://www.highline.com.pt
- Size: 123 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c8bee56cfd8d46ed8c351e31aba14c45)](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=tostasqb/hl-backend&utm_campaign=Badge_Grade)
# Getting started
- Rename the .env and provide the infomation requested there.
- rails db:migrate
- rails db:seed
- `rails s`
- Follow the "How to call" section belowThat's it!
## All with free resources (due to low traffic)
- Heroku for app
- AWS S3 for file repository
- Rails Admin for backoffice
- Cloudflare for https/caching/security
- Uptimerobot for uptime alert (and prevents heroku sleep mode)
- Sentry for error alerts# How this started
On June 2, 2018 following [this tutorial](https://www.pluralsight.com/guides/token-based-authentication-with-ruby-on-rails-5-api).
# How to call
# create a user
User.create!(email: '[email protected]' , password: '123123123' , password_confirmation: '123123123')# Authenticate the user returning a token
curl -H "Content-Type: application/json" -X POST -d '{ "email":"[email protected]","password":"123123123" }' http://localhost:3000/authenticate
> {"auth_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE0NjA2NTgxODZ9.xsSwcPC22IR71OBv6bU_OGCSyfE89DvEzWfDU0iybMA"}# Call without authorization
curl http://localhost:3000/products
> {"error":"Not Authorized"}# Call with authorization
curl -H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE0NjA2NTgxODZ9.xsSwcPC22IR71OBv6bU_OGCSyfE89DvEzWfDU0iybMA" http://localhost:3000/products
> []# Test the deploy
# running
curl http://api.highline.com.pt/ping# user authenticated
curl http://api.highline.com.pt/ping_auth# database connected
curl http://api.highline.com.pt/ping_db