Permalink
Browse files

Final rails-api notes.

  • Loading branch information...
deconstructionalism
deconstructionalism committed Jul 16, 2018
1 parent b85767f commit fe54a297f075e0c13719a3f0afaf2af1dd629388
Showing with 775 additions and 15 deletions.
  1. +70 −15 rails-api/README.md
  2. +352 −0 rails-api/images/mvc.svg
  3. +353 −0 rails-api/images/server-sequence.svg
  4. BIN rails-api/rails-api_notes.pdf
@@ -1,4 +1,4 @@
## LESSON: [rails-api](https://git.generalassemb.ly/ga-wdi-boston/rails-api)
# LESSON: [rails-api](https://git.generalassemb.ly/ga-wdi-boston/rails-api)

---

@@ -18,15 +18,15 @@ By the end of this, developers should be able to:

### VOCABULARY

**Application Programming Interface (API)**: methods exposed by an application to allow a user to interact with the necessary functions of the application without having to understand / interact witht the underlying code of the application
**Application Programming Interface (API)**: Methods exposed by an application to allow a user to interact with the necessary functions of the application without having to understand / interact witht the underlying code of the application

**Front End / Client**: Typically a browser or an app which makes requests to a server and displays an interactive UI to the client, allowing the client to interact with data stored on the server.

**Back End / Server**: The service which takes requests from a client, and completes CRUD actions requested by the client. Part of the server has the role of the controller, which implements CRUD actions requested by the client.

**Routes**: The part of a url that comes after the domain, ie `http://www.mydomain.com/<here is where the route goes>/`. Routes are closely tied by their name to the resources on the server that they interact with. For example, a `/books/` route could allow interaction with a `books` table in the database that stores book information.

**Model - View - Controller Pattern (MVC)**: A architectural pattern that specifies how the data **Model** and the client **View** interact through a **Controller**. This pattern is what is used to build **Ruby on Rails** APIS.
**Model - View - Controller Pattern (MVC)**: An architectural pattern that specifies how the data **Model** and the client **View** interact through a **Controller**. This pattern is what is used to build **Ruby on Rails** APIS.

**Model**: The data model. How the various aspects of the real world we want to keep track of are modeled, just like we model real world objects using objects in various programming languages, and a description of dependencies and interactions between model objects. A model is an abstract concept describing data organization, whereas a database in how a model is implemented in code. **It is important to note that the model is not designed with any specific considerations about the view in mind. It is "agnostic" to how the view is constructed.**

@@ -40,20 +40,75 @@ By the end of this, developers should be able to:

**Record**: One single entry in a database. An example of a record might be the object describing a single person and their in a `Persons` database table.

**Serializer**: The part of the server which
**Serializer**: The part of the server which formats the data returned by the server to the client in the response.

**Ruby on Rails (Rails)**:
**Ruby on Rails (Rails)**: A full-featured back-end web server framework written in **Ruby** that allows for very quick setup and automated modification of a server project.

### NOTES

- note about lesson

### EXAMPLES

#### Code Topic

- description of code block:
- ```js
// code goes here
```
- MVC model:
![Model-View-Controller](./images/mvc.svg)



<!--- MERMAID CODE TO GENERATE IMAGE
graph RL
subgraph CLIENT / FRONT END
A[fa:fa-laptop VIEW]
end
subgraph SERVER / BACK END
B[fa:fa-wrench CONTROLLER]
C[fa:fa-database MODEL]
end
A ==HTTP response==>B
B ==HTTP request==>A
C ===|CRUD response / request|B
classDef server fill:#D7BDE2,stroke:#333,stroke-width:4px
classDef client fill:#D1F2EB,stroke:#333,stroke-width:4px,width:90px
class A client
class B,C server
-->

- Breaking down a server into parts:

![Server sequence](./images/server-sequence.svg)

<!--- MERMAID CODE TO GENERATE IMAGE
graph TB
subgraph CLIENT / FRONT END
A[fa:fa-laptop VIEW]
end
subgraph SERVER / BACK END
subgraph SERVER
B[fa:fa-wrench ROUTER]
D[CONTROLLER]
E[SERIALIZER]
end
subgraph DATABASE
C[fa:fa-database MODEL]
end
end
D ==G - HTTP response==>A
A ==A - HTTP request==>B
C ==D - CRUD response==>D
D ==C - CRUD request==>C
B ==B - request data==>D
D ==E - data to be serialized ==> E
E ==F -serialized data ==> D
classDef server fill:#D7BDE2,stroke:#333,stroke-width:4px
classDef client fill:#D1F2EB,stroke:#333,stroke-width:4px,width:90px
classDef model fill:#FA4,stroke:#333,stroke-width:4px,width:90px
class A client
class B,D,E server
class C model
-->

Oops, something went wrong.

0 comments on commit fe54a29

Please sign in to comment.