Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

CMarzin/rails-api-with-token-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example of a rails 5 api with token generatora and upload base 64 image


For testing I recommend using Postman :)

Working on local

  • Clone the repo
git clone https://github.com/CMarzin/rails-api-with-token-generator.git
  • Install dependency
bundle install
  • Run migration and seed
rails db:migrate && rails db:seed
  • Run the server
rails s

Working on production env ( Heroku )

I assume you already have the Heroku CLI installed


WARNING

Rails 5 disables autoloading in production.

The three options are:

  1. Move lib/json_web_token.rb into app/lib/ so rails loads it automatically
  2. Use eager loading instead of autoloading: config.eager_load_paths << Rails.root.join('lib')
  3. Force rails to allow autoloading: config.enable_dependency_loading = true

I choose to do the first option

Thanks to Kevin Holler who discovered the issue.


  • Create an app heroku
  • Add the heroku remote
heroku git:remote -a the-name-of-your-app
  • Push to heroku
git push heroku master

That's it :)


This repo is made after use these two tutorial :

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published