Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translated api-proxi.md #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions docs/docs/api-proxy.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
title: Proxying API Requests in Development
शीर्षक: विकास में एपीआई अनुरोधों को सम्‍मिलित करना
---

## Resources
## साधन

If you’re not familiar with Gatsby’s lifecycle, see the overview [Gatsby Lifecycle APIs](/docs/gatsby-lifecycle-apis/).
यदि आप गैट्सबी के जीवनचक्र से परिचित नहीं हैं, तो अवलोकन देखें [गैट्सबी लाइफ़साइकल एपीआई](/docs/gatsby-lifecycle-apis/)

## Proxying API requests in development
## विकास में एपीआई अनुरोधों का समर्थन करना

People often serve the frontend React app from the same host and port as their backend implementation.
लोग अक्सर अपने बैकएंड कार्यान्वयन के रूप में उसी होस्ट और पोर्ट से फ्रंटएंड रिएक्ट ऐप की सेवा लेते हैं।

To tell the development server to proxy any unknown requests to your API server in development, add a `proxy` field to your `gatsby-config.js`, for example:
विकास सर्वर को किसी भी अज्ञात अनुरोधों को अपने एपीआई सर्वर के विकास में बताने के लिए, अपने `gatsby-config.js` के लिए एक `proxy` फ़ील्ड जोड़ें, उदाहरण के लिए:

```javascript:title=gatsby-config.js
module.exports = {
Expand All @@ -21,7 +21,7 @@ module.exports = {
}
```

or:
या:

```js:title=gatsby-config.js
module.exports = {
Expand All @@ -38,13 +38,13 @@ module.exports = {
}
```

This way, when you `fetch('/api/todos')` in development, the development server will recognize that it’s not a static asset, and will proxy your request to `http://dev-mysite.com/api/todos` as a fallback.
इस तरह, जब आप विकास में `fetch('/api/todos')` करते हैं, तो विकास सर्वर यह पहचान लेगा कि यह स्थिर संपत्ति नहीं है, और आपके अनुरोध को `http://dev-mysite.com/api/todos` ले जाएगा गिरावट के रूप में।

ध्यान रखें कि `proxy` का केवल विकास में प्रभाव है (`gatsby develop` के साथ), और यह सुनिश्चित करना आप पर निर्भर करता है कि उत्पादन में सही जगह पर `/api/todos` जैसे URL मौजूद हैं या नहीं।

Keep in mind that `proxy` only has effect in development (with `gatsby develop`), and it is up to you to ensure that URLs like `/api/todos` point to the right place in production.
## उन्नत समीपता

## Advanced proxying

Sometimes you need more granular/flexible access to the development server. Gatsby exposes the [Express.js](https://expressjs.com/) development server to your site's `gatsby-config.js` where you can add Express middleware as needed.
कभी-कभी आपको विकास सर्वर के लिए अधिक बारीक / लचीली पहुंच की आवश्यकता होती है।गैट्सबी आपकी साइट के `gatsby-config.js` के लिए [Express.js](https://expressjs.com/) विकास सर्वर को उजागर करता है जहाँ आप आवश्यकतानुसार एक्सप्रेस मिडलवेयर जोड़ सकते हैं।

```javascript:title=gatsby-config.js
const { createProxyMiddleware } = require("http-proxy-middleware") //v1.x.x
Expand All @@ -67,11 +67,11 @@ module.exports = {
}
```

Keep in mind that middleware only has effect in development (with `gatsby develop`).
ध्यान रखें कि मिडलवेयर का केवल विकास में प्रभाव होता है (`गैट्सबी डेवलप` के साथ)।

### Self-signed certificates
### स्व-हस्ताक्षरित प्रमाण पत्र

If you proxy to local APIs with self-signed certificates, set the option `secure` to `false`.
यदि आप स्व-हस्ताक्षरित प्रमाण पत्र के साथ स्थानीय एपीआई के लिए प्रॉक्सी करते हैं, तो विकल्प `secure` को `False` पर सेट करें।

```javascript:title=gatsby-config.js
const { createProxyMiddleware } = require("http-proxy-middleware") //v1.x.x
Expand Down