All About Route in Rails

What is HTTP?

The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers.
HTTP works as a request-response protocol between a client and server.
A web browser may be the client, and an application on a computer that hosts a web site may be the server.

Get vs Post

GET - Requests data from a specified resource.
POST - Submits data to be processed to a specified resource.



#Rails -- > config/route.rb

root 'pages#index'   : default route (http://localhost:3000 it will go to this route)
get 'authentication' => "login#authentication", (http://localhost:3000/authentication - it will goto login#authentication)

get 'authentication' => "login#authentication", defaults: {format: 'json'}  now can represent data in json format.

Comments