Good evening. I will continue to learn and update even on Saturdays.
I went to a bookstore today and bought a book. "Ruby on Rails Quick Learning Practice Guide" I want to do it steadily.
・ REST ・ Ruby template engine slim
These are the above two. It's a completely different theme, but if you don't understand it well I'm thinking about it, so I'll write it.
REST
Since I started doing Rails, "This design is RESTful", "REST-like" I have come to often see the word in books. But when I thought about it, I thought I didn't really understand REST. I learned using Saturday.
A web architecture style that combines the following six
-** Client / Server ** --The client sends a request to the server and the server responds to it -** Stateless server ** --The server does not manage the state of the client application -** Cache ** --Reuse the resources once acquired on the client side. -** Unified interface ** -Perform operations on resources with a unified interface (8 of GET POST PUT DELETE HEAD OPTIONS TRACE CONNECT) -** Layered system ** --The system is separated into several layers -** Code on Demand ** --A style in which the program code is downloaded from the server and executed on the client side. JavaScript is the case
The architectural style that combines these six is called REST. By the way, regarding stateless servers, cookies are From a REST point of view, it's like the wrong way to extend HTTP. It saves state and is not stateless.
But that's not necessarily a mistake It's important to be aware of REST and create applications with the minimum necessary extensions.
When I read a Rails book and said about REST, It was a unified interface. Is it possible to process with an appropriate interface? Where to say. Each interface has a role, so I had to understand it and use it.
That's it for REST! !! (It has become quite long) I thought that I would understand more if I was conscious while making an application.
slim slim is a template engine made by Ruby. You can write html more concisely and smartly.
I only knew the file format of erb, so I will summarize it.
・ I don't need <> ・ <% =%> → = ・ <%%> →- ・ Comment → / ・ Id designation → # ・ Class designation →.
All characters after | are recognized as text
p
|Text text text
Text text text
p
|
Text text text
Text text text
Conditional expressions can be omitted
- if cuser.nil?
li new registration
- else
li login
I tried to summarize only the basic part. I found out by looking it up, but it seems that there is surprisingly little to remember When I first saw it, it felt like something was wrong, I felt like it would be okay once I got used to it.
so, that's it for today.
** 97 days to become a full-fledged engineer **
Recommended Posts