G
G
getNorm2019-06-28 12:31:04
JavaScript
getNorm, 2019-06-28 12:31:04

How to link node-server & webpack-dev-server?

Hello! Help with configs (node-express-server.js + webpack-dev-server.config)
to get rid of cors-problem on localhost. I am doing a bunch of node-server + webpack-dev-server through a proxy. I have difficulties with node-server and paths, this is my first time doing it.
my webpack:

var path = require('path')

module.exports = {
    devtool: 'source-map',
    entry: [
        './src/indexCurrent.js'
    ],
    output: {
        path: path.join(__dirname, 'build'),
        filename: 'bundle.js',
        publicPath: '/static/'
    },
    devServer: {
       proxy: [{
            path: '/api/',
            target: 'http://localhost:3001'
        }],
        historyApiFallback: true
    },
//далее лодеры включены

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-06-28
@rockon404

const express = require('express');
const cors = require('cors');
const app = express();

app.use(cors());

// ...

cors

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question