1.3.21 • Published 1 year ago
wph-proxy-next v1.3.21
Proxy with NextJS
Required dependencies
npm install cookies-next
Environment variables
- Need to add following environment variables to your
NextJS App
NEXT_PUBLIC_API_URL=your_api_url
NEXT_PUBLIC_API_TOKEN=your_api_token
Setup script
- Create a file named
setup.js
at root folder (or anywhere in you project) - Copy following code and paste into the file
const {initApiInstance, generateApiRoutes} = require('wph-proxy-next');
initApiInstance(process.env.NEXT_PUBLIC_API_URL, process.env.NEXT_PUBLIC_API_TOKEN);
generateApiRoutes(path.join(__dirname, "your-target-directory"));
Run script
- Add a custom script to
package.json
to executesetup.js
file
For example:
"start": "node setup.js"
- Run this script before you build your
NextJS App
to populate api handlers
1.3.21
1 year ago
1.3.19
1 year ago
1.3.20
1 year ago
1.3.17
1 year ago
1.3.18
1 year ago
1.3.13
1 year ago
1.3.14
1 year ago
1.3.12
1 year ago
1.3.15
1 year ago
1.3.16
1 year ago
1.3.10
1 year ago
1.3.11
1 year ago
1.3.9
1 year ago
1.3.8
1 year ago
1.3.7
1 year ago
1.3.6
1 year ago
1.3.5
1 year ago
1.3.4
1 year ago
1.3.3
2 years ago
1.3.2
2 years ago
1.3.1
2 years ago
1.3.0
2 years ago
1.2.9
2 years ago
1.2.8
2 years ago
1.2.7
2 years ago
1.2.6
2 years ago
1.2.5
2 years ago
1.2.4
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.2.0
2 years ago
1.1.9
2 years ago
1.1.8
2 years ago
1.1.7
2 years ago
1.1.6
2 years ago
1.1.5
2 years ago
1.1.4
2 years ago
1.1.3
2 years ago
1.1.2
2 years ago
1.1.1
2 years ago
1.1.0
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago