reworks redirect documentation
Co-authored-by: Prince Wilson <maxcell.wilson@gmail.com>
This commit is contained in:
parent
da11162a4d
commit
736cf98c12
@ -20,7 +20,7 @@ $ npm run generate
|
||||
|
||||
In the [`netlify.toml`](./netlify.toml) configuration file there is an example of how to implement redirects. Redirects can be used to do many things from redirecting Single Page Apps more predictably, redirecting based on country/language to leveraging On-Demand Builders for [Distributed Persistant Rendering](https://www.netlify.com/blog/2021/04/14/distributed-persistent-rendering-a-new-jamstack-approach-for-faster-builds/).
|
||||
|
||||
In the example we'll be using redirects to have a more simplified call to Netlify functions. Technically when you call a function you will be making a call to `https://yoursite.netlify.com/.netlify/functions/functionName`. In order to make a cleaner path we'll redirect all calls from a path including `/api` to call on the Netlify functions. So the path will be simplified to `https://yoursite.netlify.com/api/functionName`, a lot easier to remember too.
|
||||
In the example we'll be using redirects to have a shorter endpoint to Netlify functions. By default, you call a Netlify function when requesting a path like `https://yoursite.netlify.com/.netlify/functions/functionName`. Instead, we'll redirect all calls from a path including `/api` to call on the Netlify functions. So the path will be `https://yoursite.netlify.com/api/functionName`, a lot easier to remember too.
|
||||
|
||||
|
||||
### Example
|
||||
|
Loading…
x
Reference in New Issue
Block a user