-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement basic user endpoint #1
base: master
Are you sure you want to change the base?
Conversation
.rvmrc | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should create a comment informing the purpose of db.json here
@@ -1,2 +1,3 @@ | |||
source "https://rubygems.org" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alphabetize dependencies here
r.on 'users' do | ||
# GET /api/v1/users/{email} | ||
r.get String do |email| | ||
user = users.find { |u| u['email'] == email } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No exception handling here or on Post.
Try . . .
begin
# user = users.find . . .
rescue => e
# return exception / response code here
@@ -0,0 +1,3 @@ | |||
# config.ru |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try like this according to Roda best practices:
# config.ru -- configuration file for rackup
require_relative './app'
map '/' do
run App.freeze.app
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments -- Also I like alphabetized dependencies.
Also add logging since you're importing the logger!
I implemented a basic user endpoint. The instructions to run are detailed in the README.md. Please ask for any questions!
The routes implemented thusfar are: