##INTRO
####Key components:
- Grape: the api generator
- Doorkeeper: the oauth2 provider, and protector.
- Vue.js: is used to build a client side one page javascript application which imitates a client requesting resources.
- ActiveAdmin: quick admin panel builder.
Vuejs
and grape
is drawing a lot of attetions, recently. So I decided giving them a try with this project instead of reactjs
+ Rails
as before. And this is the first time I've ever tried on these two, might took me some time to read the documents. :)
####Local Installation
bundle install
rake db:migrate
rake db:seed
this is for generating the initial admin account: [email protected]
and password
.
####Local setup
- goto http://127.0.0.1:3000/oauth/application to create a application following the instruction. This will prompt you to login as admin.
- copy the
client_id
to application.html.erb to replace the current existing one. - go to http://127.0.0.1:3000/users/sign_up to create a user. Note, you can login with
/users/sign_in
URI, but it won't give you access to the api. you still have to use this account to login on the javascript App to get access from there. - visi http://127.0.0.1:3000/ to start exploring the app and resources.
####API Enabled authentication grant types:
- password: which is used by this JS application, and also can be used for iOS or android applications developed by trusted entities (only).
- authorization_code
- client_credentials
APIs:
Current API base url: http://conichiwa.herokuapp.com/api/v0
Public APIs:
GET:/precheckin_requests
: returns all precheckin_requests as a public open api, when logged in with a resource_owner, it returns checkins of this resource owner.
GET:/precheckin_requests/:id
: single precheckin with it's :id
. Publicly available.
Need authorization:
GET/user
: returns resource owner basic profile.
GET: /users/:user_id/precheckin_requests
: returns a specific user's precheckin_requests
POST:/users/:user_id/precheckin_requests
: Creates a precheckin_request for specific user.
####Heroku app
Before testing, you might want to create a user on http://conichiwa.herokuapp.com/users/sign_up . You can find this link to lower right on the home page. Admin panel is accessable by http://conichiwa.herokuapp.com/admin with user [email protected]
password password
.