What is REST API?

Piyush Garg
16 Jan 202315:41

Summary

TLDRThe video script is a tutorial discussing the principles of RESTful API design. It emphasizes the importance of adhering to REST standards in API development, such as statelessness, client-server architecture independence, and proper use of HTTP methods. The instructor uses examples to illustrate best practices, cautioning against common pitfalls like server-side rendering and misuse of HTTP methods. The script also touches on the efficiency of RESTful APIs and the significance of respecting the architecture to ensure scalability and maintainability.

Takeaways

  • 😀 REST API stands for Representational State Transfer Application Programming Interface, emphasizing a set of standards and rules for server-client communication.
  • 🌐 The video discusses the importance of understanding RESTful principles to effectively use REST APIs in web development.
  • 💡 The tutorial aims to clarify misconceptions and provide a deeper understanding of RESTful API practices, which are crucial for developers.
  • 🛠️ It highlights that REST is based on a stateless client-server architecture, where each request from the client contains all the information needed to fulfill the request.
  • 📚 The script mentions that RESTful APIs should use appropriate HTTP methods like GET, POST, PUT, PATCH, and DELETE to perform operations on resources.
  • 🔍 The video emphasizes the importance of sending data in a format that is not dependent on the client, such as JSON, to maintain client-server independence.
  • 🚀 It points out that server-side rendering with HTML can be fast but may not be the best practice for all scenarios, especially when considering client-side diversity.
  • 🌟 The tutorial suggests that client-side rendering can offer more flexibility and independence, allowing clients to handle data in their own way.
  • 🔑 The script touches on the fact that understanding RESTful principles is important for building scalable and efficient web applications.
  • ✅ The video concludes by encouraging viewers to follow best practices when implementing RESTful APIs, such as respecting HTTP methods and maintaining client-server independence.

Q & A

  • What is the main topic discussed in the video?

    -The main topic discussed in the video is RESTful API, its principles, and best practices.

  • What does the term 'RESTful' stand for?

    -The term 'RESTful' stands for 'Representational State Transfer', which is an architectural style for networked hypermedia applications.

  • Why is it important to follow REST principles when designing APIs?

    -Following REST principles ensures that the APIs are stateless, scalable, and maintainable, which are important for building efficient and reliable web services.

  • What is the significance of the term 'stateless' in the context of RESTful APIs?

    -In the context of RESTful APIs, 'stateless' means that each request from the client to the server must contain all the information needed to understand and fulfill the request, ensuring that the server does not store any session state.

  • What does the video suggest as the best practice for client-server communication?

    -The video suggests that the best practice for client-server communication is to use JSON format for data exchange due to its lightweight and language-independent nature.

  • Why should APIs avoid server-side rendering of HTML?

    -APIs should avoid server-side rendering of HTML to prevent the server from being dependent on the client's capabilities, allowing the client to handle the rendering according to its own environment.

  • What are the common HTTP methods discussed in the video, and how should they be used?

    -The common HTTP methods discussed are GET, POST, PUT, PATCH, and DELETE. They should be used according to their intended purpose: GET for retrieving data, POST for creating new resources, PUT for updating existing resources, PATCH for partial updates, and DELETE for removing resources.

  • What is the difference between client-side and server-side rendering as mentioned in the video?

    -Client-side rendering involves sending raw data to the client, which then formats and displays it. Server-side rendering, on the other hand, involves the server generating HTML and sending it to the client, which is then displayed without further processing.

  • Why is it recommended to use JSON for API responses instead of XML?

    -JSON is recommended for API responses instead of XML because JSON is generally lighter, faster to parse, and more widely supported in modern web development environments.

  • What does the video suggest about the use of HTTP methods in API routes?

    -The video suggests that API routes should clearly respect the HTTP methods they represent, such as using GET for fetching data, POST for creating, PUT for updating, and DELETE for removing resources.

  • What is the importance of adhering to RESTful standards in API development?

    -Adhering to RESTful standards in API development is important because it promotes consistency, makes the API easier to understand and use, and helps in maintaining the API in the long run.

Outlines

00:00

🌐 Understanding RESTful APIs

The speaker begins by addressing a power outage that has caused a lack of lighting, using it as a metaphor for shedding light on the topic of RESTful APIs. They explain that REST stands for REpresentational State Transfer and involves a set of architectural constraints for the web. The video aims to discuss the concept of REST APIs, their importance, and the theoretical aspects that are crucial for practical implementation. The speaker emphasizes the need to follow best practices when dealing with REST APIs to ensure effective communication between the server and clients, which can vary from browsers to mobile devices.

05:00

🛠️ The Role of Server and Client in RESTful Communication

This section delves into the dynamics of server-client communication in RESTful APIs. The speaker describes how a client, which can be any device or software, sends a request to the server. The server's responsibility is to process this request and return a response. The communication adheres to certain standards and best practices, which are enforced by REST principles. The discussion highlights the independence of the server and client architecture and how they should not be dependent on each other. It also touches on the various formats in which data can be sent and received, such as text, images, or HTML documents, and the implications of these choices on client functionality.

10:01

📚 Adhering to RESTful Principles

The speaker focuses on the importance of adhering to RESTful principles, particularly the impact on server and client architecture. They discuss the concept of 'do less' by the server, which means the server should not be overly responsible for rendering data in a specific format. Instead, it should send data in a raw format, such as JSON, which can then be interpreted and rendered by the client. This approach reduces dependency and allows for greater flexibility and independence of the client. The speaker also addresses common misconceptions and practices, such as using GET requests for data retrieval and POST requests for data creation or deletion, aligning with HTTP method standards.

15:03

🔍 Respecting HTTP Methods and Future Tutorials

In this part, the speaker emphasizes the need to respect all HTTP methods as outlined by RESTful principles. They discuss how each method serves a specific purpose and should be used accordingly to maintain clarity and efficiency in API communication. The speaker also hints at future tutorials that will cover practical aspects of building servers using Express and working on projects that adhere to these RESTful principles. They encourage viewers to subscribe and like the video to stay updated with the upcoming content, which promises to provide further insights into implementing these concepts in real-world applications.

Mindmap

Keywords

💡REST API

REST API stands for Representational State Transfer Application Programming Interface. It is a software architectural style that defines a set of constraints to be used for creating web services. In the video, the speaker discusses REST APIs as a way to design networked applications. The concept is central to the video's theme as it sets the stage for the discussion on best practices and standards in API design.

💡Power Cut

A power cut, as mentioned in the script, refers to a sudden interruption of the electrical power supply. In the context of the video, the speaker humorously starts by mentioning a power cut as a reason for the lack of light, setting a casual tone for the video. It's a metaphorical way to introduce the topic of the video, which is about REST APIs and not directly related to electricity.

💡Thyroidical

The term 'Thyroidical' seems to be a playful or incorrect version of 'Thyrotoxic,' which is related to an overactive thyroid gland. In the script, it appears the speaker uses this term to describe the video as being a bit fast-paced or intense, possibly due to the amount of information covered. It's used to set the expectation for the viewer about the video's content and pace.

💡Client-Server Architecture

Client-server architecture is a distributed application structure that separates the functionality of a program into two parts: the client and the server. In the video, the speaker explains how REST APIs function within this architecture, with the client sending requests and the server responding. This concept is fundamental to understanding the communication flow in RESTful services.

💡Request-Response

Request-response is a fundamental concept in computer networking where a client sends a request to a server, which then processes the request and sends back a response. The video script discusses this concept as the basic interaction model in RESTful APIs, emphasizing the importance of following best practices in how these requests and responses are structured and handled.

💡Standards and Best Practices

Standards and best practices refer to the established rules and procedures that are followed in a particular field to ensure quality and consistency. In the context of the video, the speaker talks about the importance of adhering to RESTful standards and best practices when designing APIs, which helps in creating efficient, scalable, and maintainable applications.

💡Statelessness

Statelessness is a key constraint of RESTful services, meaning that each request from the client must contain all the information the server needs to fulfill the request. The video script mentions statelessness as a rule that should be followed to ensure that the server does not store any client-specific information that would make it dependent on the client's state.

💡JSON

JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write and easy for machines to parse and generate. The speaker in the video discusses JSON as a preferred format for sending data in RESTful APIs due to its simplicity and efficiency, especially when compared to other formats like XML.

💡HTTP Methods

HTTP methods are the building blocks of RESTful APIs, defining the type of action to be performed on a resource. The script mentions common HTTP methods such as GET, POST, PUT, PATCH, and DELETE. These methods are crucial for understanding how to interact with resources in a RESTful manner, with each method having a specific purpose and usage.

💡Server-Side Rendering

Server-side rendering refers to the process where the server generates the HTML of a web page and sends it to the client. In the video, the speaker discusses the concept of server-side rendering in the context of REST APIs, explaining how it can be used to improve the performance of web applications by rendering the HTML on the server before sending it to the client.

💡Client-Side Rendering

Client-side rendering is the process of generating HTML on the client's machine, typically done by JavaScript. The speaker contrasts this with server-side rendering, explaining that in RESTful APIs, the data is often sent in a format like JSON, and the client is responsible for rendering it into a human-readable format. This approach can lead to a more flexible and interactive user experience.

Highlights

Introduction to REST APIs and their importance in modern web development.

Explanation of RESTful principles and how they differ from other API styles.

Discussion on the standards and rules that define RESTful APIs.

The concept of server-client architecture and its role in RESTful APIs.

How communication between server and client is facilitated through request and response.

The significance of following best practices in REST API development.

The first rule of RESTful APIs: reducing dependency on the server-client architecture.

The importance of choosing the right format for the response data.

Comparison between server-side rendering with HTML and client-side rendering with JSON.

Advantages of server-side rendering and its impact on performance.

The concept of client-side rendering and its benefits for cross-platform applications.

The decision-making process for choosing between HTML and JSON responses.

The role of HTTP methods in RESTful APIs and respecting their intended use.

Common mistakes in API design and how to avoid them by following RESTful principles.

The impact of API design on client-side application development.

Strategies for handling authentication and authorization in RESTful APIs.

The importance of following best practices for long-term API maintenance and scalability.

Conclusion and a look ahead to the next tutorial in the series.

Transcripts

play00:00

एवरीवन वेलकम बैक एंड वेलकम तू अंदर

play00:02

वीडियो

play00:06

पुर ठीक है बिकॉज यहां पर आज लाइट नहीं है

play00:09

यहां पर आज एक पावर कट है सो देयर इस नो

play00:12

लाइट आई एम सॉरी फॉर डेट तो इस वीडियो में

play00:15

हम डिस्कस करने वाले हैं रेस्ट ऐप तो हम

play00:17

देखने वाले हैं रेस्ट एपीआई क्या होता है

play00:18

ये वीडियो थोड़ा सा thyroidical होने वाला

play00:20

है ओके सो थोड़ा थिअरीज ज्यादा होगा बट

play00:23

उसके बाद सी कैन स्टार्ट विद आर प्रोजेक्ट

play00:25

बेस्ड लर्निंग तो ये वीडियो इंपॉर्टेंट है

play00:28

तो थोड़ा सा थ्योरी जाना इंपॉर्टेंट है सो

play00:30

डेट हम अपनी स्किल्स को हम अपने बेस्ट

play00:32

प्रैक्टिसेज को फॉलो कर सकें ओके सो लेट्स

play00:34

स्टार्ट विथ डी वीडियो तो पहले समझते हैं

play00:36

टेस्ट एपीआई होता क्या है ठीक है सो देयर

play00:38

इस अन थिंग नॉन आज

play00:40

रेस्टफुल

play00:43

बैक एंड डेवलपर तो ये टर्म बहुत ज्यादा

play00:46

तुम्हारे सामने आएगी रेस्ट एपीआई भी का

play00:48

सकते हैं रेस्ट का सकते हैं तो ये होता

play00:52

क्या है सो व्हाट इसे डी बेस्ट फुल

play00:54

ऐसे डिफरेंट कैसे होता है ठीक है तो रेस्ट

play00:58

फुल आप है बेसिकली एक रिप्रेजेंटेशन स्टेट

play01:01

होती है ठीक है

play01:03

जिसके कुछ स्टैंडर्ड होते हैं ठीक है

play01:05

जिसके कुछ रूल्स होते हैं ओके तो इसके कुछ

play01:08

रूल्स होते हैं तो ये रूल्स एक-एक करके

play01:10

डिस्कस करते हैं तो ये बेसिकली बेस्ट

play01:12

प्रैक्टिस होती है जो हमें फॉलो करनी

play01:13

चाहिए एंड दें ओनली अगेंस्ट है की जो मेरा

play01:15

सर्वर है ना वो एक रेस्टफुल एपीआई के ऊपर

play01:18

बनाया ओके तो पहले क्या होता है डेट अगर

play01:21

मैं यहां पर एक सर्वर की बात करता हूं ठीक

play01:23

है तो अगर हम अपने बेसिकली हम अपने

play01:25

क्लाइंट की बात करते हैं तो हमारे पास

play01:27

क्या होता है हमारे पास एक सर्वर होता है

play01:28

करेक्ट तो ये मेरा क्या है ये मेरा एक ओवर

play01:31

है एंड सिमिलरली हमारे पास क्या होता है

play01:32

हमारे पास एक क्लाइंट होता है अब ये जो

play01:35

क्लाइंट है ना ये जो क्लाइंट है ये कुछ भी

play01:38

हो सकता है एक लाइन कुछ भी हो सकता है ये

play01:40

एक ब्राउज़र हो सकता है ये एक मोबाइल फोन

play01:43

हो सकता है मतलब ये बेसिकली एक अलग सा

play01:46

जैसे एक स्मार्ट डिवाइस भी हो सकता है तो

play01:48

ये जो मेरा क्लाइंट है ना ये टेक्निकल कुछ

play01:50

भी हो सकता है ठीक है एंड ये दोनों

play01:52

कम्युनिकेशन कैसे करते हैं ठीक है ये

play01:54

दोनों का मीनिंग गेट कैसे करते हैं तो ये

play01:55

एक रिक्वेस्ट सेंड करता है ठीक है तो ये

play01:58

एक रिक्वेस्ट सेंड करता है एंड रिटर्न

play02:00

हमारा जो सर्वर है वह क्या करता है

play02:02

रिस्पांस को रिटर्न करता है अब यह जो

play02:05

कम्युनिकेशन होता है ना सर्वर और क्लाइंट

play02:07

का बेसिकली रिक्वेस्ट रिस्पांस इस चीज के

play02:10

ऊपर कुछ रूल्स होते हैं कुछ बेस्ट

play02:12

प्रैक्टिस होती हैं ठीक है जो दोनों को

play02:13

फॉलो करनी चाहिए एंड वो बेस्ट प्रैक्टिस

play02:16

वो स्टैंडर्ड कौन देता है वो हमें रेस्ट

play02:17

ऐप है ठीक है अगर तुम रेस्टफुल एपीआई की

play02:20

डेफिनेशन देखोगे तो काफी जगह लिखा जाएगा

play02:22

डेट restoli पे कोई स्टैंडर्ड नहीं होते

play02:24

बट एक्चुअली ये स्टैंडर्ड होते हैं देयर

play02:27

आर सैम गुड प्रैक्टिस जो हमें फॉलो करनी

play02:28

चाहिए ठीक है हम इस चीज पर आगे नहीं

play02:31

करेंगे डेट ये बेस्ट प्रैक्टिस है या नहीं

play02:33

है बट हम वो करेंगे जो इंडस्ट्रीज में उसे

play02:35

किया जाता है और जो बेस्ट हो ठीक है तो

play02:38

सबसे पहले क्या होता है वो कहता है वो

play02:40

क्या कहता है डट ना पहला रूल होता है ये

play02:43

किस उसपे कम करता है बोलता है सर्वर

play02:46

क्लाइंट आर्किटेक्चर पर कम करता है ओके सो

play02:49

ये ये किस बेसिस पे कम करता है ये कम करता

play02:52

है

play02:52

सावर

play02:54

एंड क्लाइंट

play02:56

आर्किटेक्चर इसका क्या मतलब इसका मतलब

play02:59

होता है

play03:01

मतलब सर्वर एक डिफरेंट मशीन है और क्लाइंट

play03:05

एक डिफरेंट मशीन है एंड दोनों को एक दूसरे

play03:08

के ऊपर डिपेंडेंट नहीं होना चाहिए इसका

play03:10

क्या मतलब जैसे मैंने यहां पर यह रिस्पांस

play03:13

सेंड किया था करेक्ट ये रिस्पांस मैंने

play03:14

सेंड किया था ये रिस्पांस का जो फॉर्मेट

play03:17

है वो क्या हो सकता है तो मैं क्या का

play03:18

सकता हूं ये जो रिस्पांस ही मेरा टेक्स्ट

play03:20

हो सकता है बिल्कुल हो सकता है क्या ये जो

play03:22

मेरा रिस्पांस है ये इमेज फाइल हो सकती है

play03:24

बिल्कुल हो सकती है क्या ये रिस्पांस एक

play03:27

एचटीएमएल डॉक्यूमेंट हो सकता है बिल्कुल

play03:30

हो सकता है करेक्ट क्या ये जेसन हो सकता

play03:32

है ठीक है जेसन क्या होता है

play03:33

जावास्क्रिप्ट ऑब्जेक्ट नोटेशन हो सकता है

play03:36

ठीक है लेकिन इनमें से क्या हमें सेंड

play03:38

करना चाहिए तो ध्यान से देखना अगर मैं

play03:41

अपने डाटा कोड एचटीएमएल डॉक्यूमेंट सेंड

play03:44

कर दो मैंने क्या किया फॉर एग्जांपल तुमने

play03:46

गेट रिक्वेस्ट किया क्या तो तुमने गेट

play03:48

रिक्वेस्ट किया मुझे डेट यू वांट तू गेट

play03:50

सैम ब्लॉग्स ठीक है

play03:52

तो तुमने कुछ ब्लॉग्स के लिए गेट

play03:54

रिक्वेस्ट किया एंड मैंने क्या किया मैंने

play03:56

ब्लॉक को डेटाबेस में से सर्च किया तो

play03:58

यहां पर मेरा डाटा बेस है करेक्ट तो लेटर

play04:00

से ये मेरा डाटा बेस है मैंने अपने डाटा

play04:02

को इसमें से ब्लॉक को फेच किया और मैंने

play04:04

क्या किया मैंने उसके एक एचटीएमएल

play04:05

डॉक्यूमेंट बना दिया मैंने उसका एक

play04:07

एचटीएमएल डॉक्यूमेंट बना दिया और ये

play04:08

एचटीएमएल डॉक्यूमेंट मैंने तुमको सेंड कर

play04:10

दिया आज अन

play04:12

अगर तो तुम्हारा जो क्लाइंट है वो एक

play04:15

ब्राउज़र है ठीक है अगर तो वो एक ब्राउज़र

play04:16

है तो कोई प्रॉब्लम नहीं तुम क्या करोगे

play04:18

जो एचटीएमएल डॉक्यूमेंट आया वो रेंडर हो

play04:20

जाएगा स्क्रीन पे एंड ठीक है यूजर को अपने

play04:22

डाटा मिल गया बट व्हाट इफ अगर ये एक

play04:25

मोबाइल होता अगर ये अलेक्सा डिवाइस होती

play04:27

तो उसे केस में क्या होता है उसे केस में

play04:29

obbviously दे कनॉट टेंडर एचटीएमएल ठीक है

play04:31

तो यहां पर एक प्रॉब्लम है सेकंड प्रॉब्लम

play04:33

क्या है यहां पर हम डिसाइड कर रहे हैं की

play04:35

हमें अपने डाटा को किस तरह से शो करना है

play04:37

बिकॉज जो एचटीएमएल है वो कौन बना रहा है

play04:39

वो हमारा सर्वर बना रहा है तो यहां पर

play04:41

कहीं ना कहीं से डेट जो ये मेरा क्लाइंट

play04:44

है ना ये तो पेंट हो रहा है ये डिपेंडेंट

play04:46

है किसके ऊपर

play04:47

के ऊपर तो रेस्ट फुल एपीआई के अंदर ये

play04:50

वाली चीज नहीं होनी चाहिए ठीक है

play04:52

इस चीज को पैसे हम क्या कहते हैं यह हम

play04:54

एचटीएमएल सेंड करते हैं इसको हम बोलते हैं

play04:55

सर अलसो नॉन एस सर्वर साइड रेंडरिंग ठीक

play04:58

है तो इसको हम क्या बोलते हैं इसको हम

play05:00

बोलते हैं serversitront बिकॉज हमने क्या

play05:02

किया हमने पेज को ना सर्वर पर रेंडर कर

play05:04

दिया हमने एचटीएमएल क्या किया हमने अपने

play05:06

एचटीएमएल को सर्वर पे ही जेनरेट कर लिया

play05:08

एंड हमने वो रेंटेड चीज हमने वो रांदेड

play05:10

पेज को क्या किया हमने वो क्लाइंट को सेंड

play05:12

कर दिया ये चीज बहुत फास्ट होती है ठीक है

play05:14

इसकी अपने एडवांटेजेस होते हैं हम इसको भी

play05:16

पढ़ने वाले हैं अच्छे से तो ये चीज बहुत

play05:18

फास्ट होती है सीकर होती है एवं गूगल

play05:20

यूट्यूब वगैरा सर्विस करते हैं लेकिन

play05:23

दूसरी जगह आता है जिस्म ठीक है तो दूसरी

play05:25

प्लेस पे कौन आता है जैसा ना होता है

play05:26

उसमें मैं क्या कर सकता हूं बेसिकली वो

play05:28

क्या कहता है डेट डेट तुम क्या कर सकते हो

play05:30

तुमने जो डाटा बेस में से डाटा को कोई

play05:32

नहीं किया ठीक है तो ये हमारा जो सर्वर था

play05:34

ये हमारा डेटाबेस के पास गया इसने डाटा को

play05:37

कोई किया अब ये जो डाटा है ना इसको हम

play05:39

क्या करेंगे इसको हम किसी फॉर्मेट में

play05:41

जैसे फॉर एग्जांपल हमारे पास एक इगल

play05:43

फॉर्मेट होता है ठीक है एक होता है और एक

play05:46

होता है जी सर ओल्ड मतलब पुराने जमाने में

play05:49

exompal उसे किया जाता था लेकिन अब जैसे

play05:51

उसे किया जाता है तो जेसन बेसिकली क्या

play05:53

वैल्यू पेयर्स होती है ठीक है

play05:56

तो मैं क्या करूंगा डाटा को आगे अन जेसन

play05:59

सेंड कर सकता हूं ठीक है मैं इसको ऐसे

play06:01

जेसन सेंड कर सकता हूं विच इस जस्ट की

play06:03

वैल्यू पर्स मतलब की एक तरह का रॉ डाटा

play06:06

सेंड कर दिया तो मतलब मैंने एक तरह का रॉ

play06:08

डाटा सेंड कर दिया अब क्लाइंट क्या करेगा

play06:10

ना जो मेरा क्लाइंट है अब ये जो मेरा

play06:12

क्लाइंट है ना ये क्या करेगा इस जेसन को

play06:14

रीड करेगा ठीक है इसके पास क्या है gsnl

play06:16

आया अब ये क्लाइंट में भी इट्स अन मोबाइल

play06:20

एप्लीकेशन कुछ भी यही है क्या करेगा इस

play06:22

डीसेंट रीडर डाटा को रीड करेगा एंड खुद की

play06:25

स्क्रीन पर इंटर कर लेगा ठीक है खुद की

play06:27

स्क्रीन पे क्या करेगा खुद बी खुद रेंडर

play06:28

कर लेगा तो इसमें बेसिकली डिपेंडेंसी नहीं

play06:30

है ठीक है मेरे 100 का कम क्या था की

play06:33

डेटाबेस के पास जाओ डाटा को गेट करो और

play06:35

मुझे दे दो उसने जीएसएम फॉर्मेट में दे

play06:36

दिया अब मैं आगे अन क्लाइंट इंडिपेंडेंट

play06:39

सीट आपको प्रक्रिया कर सकता हूं इसके ऊपर

play06:41

कुछ भी मेरी जो प्रोसेसिंग है कुछ भी मुझे

play06:44

कोई कम करना है वो मैं कर सकता हूं एंड

play06:45

अपने अकॉर्डिंग मैं इसको अपनी स्क्रीन पर

play06:48

इंटर कर सकता हूं तो ये चीज होती है

play06:49

फर्स्ट एवर उसे करना है तो बेसिकली क्या

play06:53

करेगा सर्वर अपना कम करेगा आइसोलेशन में

play06:55

डाटा को आगे अन रॉ फॉर्मेट में देगा जैसे

play06:57

ग्सन फॉर्मेट में दे देगा क्लाइंट पर

play06:59

हमारे पास रिएक्ट लैंग्वेज हो सकती है

play07:01

हमारे पास एक ब्राउज़र हो सकता है मेबी

play07:04

हमारे पास एक मोबाइल है मेबी ये मोबाइल

play07:06

एप्लीकेशन फ्लर्ट में बनाएं हमें फर्क

play07:08

नहीं पड़ता हमने अपना डाटा अस ए रॉ दे

play07:11

दिया फ्रंट एंड कैन डिसाइड डेट इसको क्या

play07:14

करना है ठीक है अब यहां पर बेसिकली क्या

play07:16

होता है डेट एचटीएमएल डॉक्यूमेंट कब उसे

play07:18

करना चाहिए जिस दिन कभी उसे करना चाहिए

play07:19

अगर तुमको पता है डेट जो तुम्हारा क्लाइंट

play07:22

है ना वो एक ब्राउज़र ही होने वाला है

play07:24

जैसे फॉर एग्जांपल google.com को पता है

play07:26

डेट google.com हमेशा एक ब्राउज़र पर ही

play07:28

होता है तो उसे केस में हमें हमेशा

play07:30

एचटीएमएल ही सेंड करना चाहिए करेक्ट बिकॉज

play07:32

क्या है ना फिर क्लाइंट के ऊपर कम बढ़

play07:34

जाता है अगर तुम और डाटा सेंड कर रहे हो

play07:35

तो पहले

play07:36

क्लाइंट के ऊपर उसको रेंडर करोगे तो

play07:39

तुम्हारे स्टेप इंक्रीज हो रहा है

play07:42

जो तुम्हारा क्लाइंट है वो तुम्हारा एक

play07:44

ब्राउज़र ही है ठीक है तुम्हारा एक वेब

play07:46

एप्लीकेशन ही है तो उसे केस में गुड

play07:48

प्रैक्टिस तो ऑलवेज सेंड इन एचटीएमएल

play07:50

बिकॉज एचटीएमएल फास्ट होता है कोई

play07:52

प्रोसेसिंग नहीं करनी पड़ती स्क्रीन पर

play07:53

डाटा अवेलेबल हो जाता है बट अगर तुम्हारा

play07:57

क्रॉस प्लेटफार्म

play08:04

की जो क्लाइंट वाली टीम है जो मेरी फ्रंट

play08:07

एंड की टीम है वो अपने हैंडल कर लेगी की

play08:09

इस डाटा को कैसे डिस्प्ले करना है तो ये

play08:10

एक फर्क होता है तो रेस्टिंग पे बेसिकली

play08:12

क्या कहता है डेट ऑलवेज फॉलो दिस सर्वर

play08:14

एंड क्लाइंट आर्किटेक्चर मतलब यू शुड नो

play08:16

डेट सर्वर एक डिफरेंट चीज है क्लाइंट एक

play08:19

डिफरेंट चीज है ठीक है तो फर्स्ट पॉइंट ये

play08:21

था सेकंड पॉइंट तो सेकंड पॉइंट क्या होता

play08:23

है डेट ऑल बेस ठीक है ऑलवेज रिस्पेक्ट

play08:29

ऑल एचटीटीपी मेथड

play08:37

ठीक है ऐसा नहीं है की मतलब ये है तो हमें

play08:41

बस इसके पीछे का इंटेंशन समझता है ठीक है

play08:42

तो इसका क्या मतलब होता है ऑलवेज

play08:44

रिस्पेक्ट ऑल एचडी टीवी मैथर्ड तो हमने एक

play08:47

वीडियो में एचटीटीपी मेथड देके द कौन-कौन

play08:49

से मैथर्ड होता है हमारे पास एक होता है

play08:50

गेट हमारे पास पोस्ट था हमारे पास पुट था

play08:55

हमारे पास पैच था हमारे पास क्या था डिलीट

play08:59

था करेक्ट तो ये कुछ एचटीटीपी मेथड से जो

play09:02

हमने एक वीडियो में देखे द तो यह

play09:04

पार्टिकुलर रूल क्या कहता है डेट हमें ना

play09:06

इनका रिस्पेक्ट करना चाहिए जो ये कर रहे

play09:08

हैं जो इनका नाम है जो इनको करना चाहिए

play09:10

हमें उसको रिस्पेक्ट करना चाहिए इसका क्या

play09:11

मतलब फॉर एग्जांपल अगर मैं यहां पे लिखता

play09:13

हूं मतलब मैंने एक बनाया गेट तू स्लैश

play09:17

यूजर ठीक है तो इसरो को क्या करना चाहिए

play09:20

बेसिकली मुझे ना यूजर्स का जो डाटा है वो

play09:23

रिटर्न कर देना चाहिए

play09:31

रिटर्न ठीक है तो यह हम बेसिकली रिस्पेक्ट

play09:36

कर रहे हैं

play09:39

सिमिलरली अगर मैं यहां पर एक पोस्ट राउत

play09:42

बनाता हूं स्लैश यूजर पर ही ठीक है तो

play09:45

इसका क्या मतलब होगा डेट हैंडल करना यहां

play09:48

पर मुझे क्या हैंडल करना है डेट एक न्यू

play09:49

यूजर क्रिएट करना है सो हैंडल न्यू यूजर

play09:52

क्रिएशन करेक्ट है बिकॉज पोस्ट का मतलब

play09:56

क्या होता है की हमें कोई डाटा म्यूट करना

play09:58

है सिमिलरली अगर मुझे इस यूजर की कोई

play10:00

इनफॉरमेशन को एडिट करना है ठीक है तो मैं

play10:02

क्या करूंगा मैं यहां पर एक पैच आउट

play10:04

बनाऊंगा पैच स्लैश यूजर तो इसका मतलब क्या

play10:08

है डेट अपडेट

play10:10

दी यूजर तो यहां पर जो मेरा आर्किटेक्चर

play10:15

है ना जो मेरा आर्किटेक्चर है ना वो इन

play10:18

सभी की रिस्पेक्ट कर रहा है

play10:31

अपडेट

play10:33

यूजर ठीक है

play10:39

तो क्या यह सही चीज है मतलब ठीक है मेरा

play10:42

कम हो जाएगा

play10:49

जिसका नाम होगा क्रिएट

play10:53

यूजर ठीक है और ये क्या करेगा ये बेसिकली

play10:55

यूजर को क्रिएट कर देगा कम करेगा

play10:58

टेक्निकल हमारा कम हो जाएगा ठीक है तो

play11:00

यहां पे हम अपडेट कर देंगे यूजर को और इसे

play11:02

अंडर में हम अपनी यूजर को क्रिएट कर देंगे

play11:04

बट क्या ये एक बेस्ट प्रैक्टिस है लाइक वो

play11:07

करेगा जब हम ने एक पैच नाम का अलग से एक

play11:10

एचडी टीवी मेथड बनाया है व्हेन जब एक पैच

play11:13

रिक्वेस्ट एक्जिस्ट करती है सो वही आर यू

play11:16

क्रिएटिंग दिस थिंग्स तो तुम क्यों कर रहे

play11:19

हो ये चीज है ना मतलब पहले तुम यहां पर

play11:21

लिख रहे हो पोस्ट फिर तुम उसके बाद यहां

play11:22

पर ये मेंशन भी कर रहे हैं डेट ये एक्शन

play11:24

क्या है तो ये कन्फ्यूजन क्रिएट कर रहा है

play11:27

सिमिलरली अगर मैं यहां पर बोलूं गेट

play11:29

रिक्वेस्ट ठीक है

play11:35

मतलब यह कन्ज्यूरिंग नहीं है था

play11:38

ओबवियसली अगर मैं गेट रिक्वेस्ट कर रहा

play11:40

हूं तो मुझे यूजर को गेटिंग करना है तो

play11:41

तुम यहां पर गेट क्यों लगा रहे हो ठीक है

play11:43

तो ये कुछ प्रैक्टिसेज हैं ठीक है ये कुछ

play11:46

प्रैक्टिसेज हैं अगर हम इन दोनों चीजों को

play11:48

फॉलो कर देना तब मैं बोल सकता हूं डेट यस

play11:50

मेरा ये क्या है ये रेस्टफुल है ठीक है

play11:52

बहुत सारे लोग इन फैक्ट आई वुड से 80% ऑफ

play11:56

डी लोग इन चीजों को उसे नहीं करते 80% ऑफ

play11:59

डी लॉक अपना पूरा जो सर्वर कोड करते हैं

play12:01

ना वो कैसे करते हैं वो या तो गेट का उसे

play12:04

करते हैं या पोस्ट का उसे करते हैं जब भी

play12:06

कोई डाटा गेट करना है तो गेट और अगर

play12:08

उन्होंने कोई भी डाटा को पुट पैच या डिलीट

play12:10

करना है वो पोस्ट का उसे करते हैं लेकिन

play12:13

हम ऐसा नहीं करने वाले ठीक है तो फॉर

play12:16

एग्जांपल जैसे अगर हमें कोई डाटा कोई यूजर

play12:18

डिलीट करना है सो मोस्ट ऑल टाइम क्या होगा

play12:20

मेबी यू विल हैव अन पोस्ट अलाउड जिसका नाम

play12:23

क्या होगा डिलीट

play12:25

यूजर और इसके ऊपर क्या कर रहे होंगे वो

play12:28

यूजर को डिलीट कर देंगे ठीक है तो यही चीज

play12:30

नहीं करनी हमें हमेशा क्या करना है हमें

play12:33

जो ये हमें मेथड दिए गए हैं ना हमें डेट

play12:35

दिया गया हमें पोस्ट दिया गया

play12:38

डिलीट दिया गया हमें इनकी रिस्पेक्ट करनी

play12:42

है हमें इन मैथर्ड के रिस्पेक्ट करनी है

play12:44

एंड जिस तरह से ये मेथड कम करता है जो भी

play12:47

इनका रूल है हम उनके रिस्पेक्ट करेंगे ठीक

play12:49

है तो यानी की जब हम अपना सावर बनाएंगे

play12:51

पहली बार हम क्या करेंगे हमें पता है ठीक

play12:55

है तो यहां पे बताता हूं सी नो डेट अभी जो

play12:57

हमारा क्लाइंट है ना हमारा जो क्लाइंट है

play13:00

वो कौन है वो एक ब्राउज़र है करेक्ट तो हम

play13:03

क्या करेंगे हम हमेशा एचटीएमएल डाटा इंटर

play13:05

करेंगे ठीक है बिकॉज आई नो डेट मेरा वो

play13:07

ब्राउज़र इसके बाद जब हम रिएक्ट शुरू

play13:10

करेंगे ना

play13:11

तब हम क्या करेंगे तब हम जेसन रिस्पांस

play13:14

सेंड करेंगे बिकॉज उसे टाइम पे हमें अपना

play13:16

जो डाटा है वो हमें क्लाइंट पर हैंडल करना

play13:18

है बट इस ट्यूटोरियल सीरीज में नोट जिसमें

play13:21

हम क्या करेंगे हम एचटीएमएल करेंगे नंबर

play13:23

तू हम क्या करेंगे हम रिस्पेक्ट करेंगे हम

play13:26

रिस्पेक्ट करेंगे एचडी टीवी मैथर्ड की ठीक

play13:29

है अगर हम ये चीज करते हैं

play13:33

ठीक है

play13:35

बना लिया सो दिस इसे रेसिपी

play13:40

हैंडल करने की जरूरत नहीं पड़ती बट उसके

play13:43

लिए जैसे हम ऑथेंटिकेशन एंड ऑथराइजेशन

play13:44

करेंगे तो उसे चीज को हम तब समझेंगे बट

play13:47

अभी ये चीज थोड़ा समझना इंपॉर्टेंट था डेट

play13:50

हमें किन चीजों की रिस्पेक्ट करनी है

play13:51

रेपाल पे क्या होता है ओके एंड वैन मोर

play13:54

थिंग जेसन एंड एचटीएमएल को हैंडल करना आ

play13:56

एक्सप्रेस जीएस में बहुत एजी है आई कैन

play13:58

जस्ट से जहां पे हम रिस्पांस डॉट सेंड

play14:01

करते हैं ना वहां पे आई विल से रिस्पांस

play14:04

डॉट जेसन एंड मैं स्क्रीन अपना जेसन

play14:07

ऑब्जेक्ट दे दूंगा तो ऑटोमेटेकली क्या बन

play14:09

जाएगा

play14:10

ओके सो रिस्पांस और जातियों करने से मैं

play14:13

अपने एप्स मतलब बेसिकली जीएसएम रिस्पांस

play14:16

एंड कर सकता हूं एंड अगर मुझे कुछ भी

play14:17

रेंडर करना है तो हमारे पास सेंड एंड

play14:19

रिस्पांस डॉट रेंडर मैथर्ड होते हैं जिसके

play14:22

साथ में क्या कर सकता हूं मैं बेसिकली

play14:24

एचटीएमएल को और इंटर कर सकता हूं ठीक है

play14:26

एचटीएमएल रेंडरिंग जो होते है वो फास्ट

play14:28

होती है बिकॉज नेक्स्ट स्टेप कम होता है

play14:30

करेक्ट बिकॉज मैंने क्या किया एचटीएमएल को

play14:32

पहले ही रेंडर करके ब्राउज़र पर इंटर कर

play14:33

दिया अगर तुम 1920 करते हो इसको हम कहते

play14:36

हैं

play14:38

सर मतलब जहां पे हमारे पास जेसन डाटा आता

play14:41

है एंड हम उसको खुद बी खुद रेंडर करते हैं

play14:43

उसको हम बोलते हैं क्लाइंट साइड एंट्री जो

play14:45

की रिएक्ट करती है ये स्लो होती है बिकॉज

play14:48

डाटा पहले फेच होता है उसके बाद रेंडर

play14:50

होता है लेकिन सर्वर साइड rekssr इस रियली

play14:55

फास्ट क्यों बिकॉज डाटा आते ही रेंडर हो

play14:57

जाता है करेक्ट सो सी हैव तू फॉल ऑफ दिस

play15:00

एस आर थिंग इन दिस पार्टिकुलर ट्यूटोरियल

play15:02

सीरीज सो आने वाली वीडियो में जब हम

play15:05

रिएक्शन करेंगे तब हम सर को पढ़ेंगे उसके

play15:07

अपनी उसे केसेस होते हैं ठीक है एंड इसके

play15:09

अपने उसे कैसे होते हैं सो आय होप ये

play15:11

वीडियो इनफॉर्मेटिव रहा होगा इस वीडियो

play15:12

में कुछ नया या फिर बेस्ट प्रैक्टिस का

play15:15

हमें एक आइडिया लगा होगा डेट कैसे चीजें

play15:17

कम करती है ठीक है तो हमें ध्यान रखना है

play15:19

डेट हम अपना जो कोड करेंगे ना हम इस बेस्ट

play15:22

प्रैक्टिस इसको देखते हुए करेंगे तो हम इन

play15:24

बेस्ट प्रैक्टिस को फॉलो करने वाले हैं

play15:25

एंड हम अपने जो प्रोजेक्ट है वो बनाने

play15:27

वाले हैं सो फ्रॉम दी नेक्स्ट वीडियो अब

play15:29

हम सही में एक सर्वर को कोड करने वाले

play15:31

यूजिंग एक्सप्रेस एंड हम कुछ प्रोजेक्ट्स

play15:33

बनाने वाले हैं सो स्टे टी एंड वीडियो

play15:36

अच्छा लगा तो सब्सक्राइब एंड लाइक जरूर

play15:37

करना मिलते आपको नेक्स्ट वीडियो में अंटील

play15:39

दें बाय टेक केयर

Rate This

5.0 / 5 (0 votes)

関連タグ
RESTful APIWeb DevelopmentTutorialBest PracticesSoftware ArchitectureCoding StandardsHTTP MethodsDeveloper GuideAPI DesignTech Education
英語で要約が必要ですか?