summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/views/errors/not_found.json4
-rw-r--r--app/views/errors/server_error.json4
-rw-r--r--config/routes.rb5
3 files changed, 11 insertions, 2 deletions
diff --git a/app/views/errors/not_found.json b/app/views/errors/not_found.json
new file mode 100644
index 0000000..2fcc629
--- /dev/null
+++ b/app/views/errors/not_found.json
@@ -0,0 +1,4 @@
+{
+ "error": "not_found",
+ "message": "Not Found"
+} \ No newline at end of file
diff --git a/app/views/errors/server_error.json b/app/views/errors/server_error.json
new file mode 100644
index 0000000..d9a1a86
--- /dev/null
+++ b/app/views/errors/server_error.json
@@ -0,0 +1,4 @@
+{
+ "error": "server_error",
+ "message": "Server Error"
+} \ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index c455dd7..e370aa4 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -26,9 +26,10 @@ LeapWeb::Application.routes.draw do
namespace "api", { module: "v1",
path: "/1/",
- defaults: {format: 'json'} } do
- resources :sessions, :only => [:new, :create, :update],
+ defaults: {format: 'json'},
:constraints => { :id => /[^\/]+(?=\.json\z)|[^\/]+/ }
+ } do
+ resources :sessions, :only => [:new, :create, :update]
delete "logout" => "sessions#destroy", :as => "logout"
resources :users, :only => [:create, :update, :destroy, :index, :show]
resources :messages, :only => [:index, :update]