🚀 Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

razzle-plugin-spa-api-proxy

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

razzle-plugin-spa-api-proxy

Razzle plugin to proxy API requests for SPA build type using Webpack

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

razzle-plugin-spa-api-proxy

This module contains a plugin to proxy API requests for SPA build type using Webpack dev server proxy with Razzle.

Usage in Razzle Projects

yarn add razzle-plugin-spa-api-proxy --dev

With default options

// razzle.config.js

module.exports = {
  plugins: ['spa-api-proxy'],
};

All request with path starting with /api will be directed to http://localhost:8080/api.

With custom config

// razzle.config.js

module.exports = {
  plugins: [
    {
      name: 'spa-api-proxy',
      options: {
        clientPath: '/custom-api',
        apiUrl: 'https://my-api.example.com'
      },
    },
  ],
};

Options

Object with fields below or array of such objects if you need to proxy sever paths.

clientPath

default: /api

Path that will be directed to API server

apiHost

default: localhost

API server host

apiPort

default: 8080

API server port

useSSL

default: false

Use HTTPS connection

apiUrl

default: http://localhost:8080

Shorthand for apiHost, apiPort and useSSL options. Will override former if both are present.

Keywords

Razzle

FAQs

Package last updated on 28 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts