Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kyrivanderpoel
Copy link

@kyrivanderpoel kyrivanderpoel commented Oct 14, 2018

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:

GET /api/v1/users - gets all users
POST /api/v1/users - create a new user
GET /api/v1/users/{email} - get user with the specified email

.rvmrc

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"

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 }

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

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

Copy link

@JordanRushing JordanRushing left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants