A
A
Alexander2017-08-07 15:25:59
Express.js
Alexander, 2017-08-07 15:25:59

How to add a simple express server to create-react-app?

I need to test a couple of requests to the server via Ajax, how to do it using Create react App?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alvvi, 2017-08-07
@alvvi

article

S
SweetPony1, 2017-08-16
@SweetPony1

And does it work?
I have this config
//package.json

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "proxy": "http://192.168.220.129:80",

there are addresses
http://192.168.220.129:80/index.php
http://192.168.220.129:80/images/dump.png
when I go to
localhost:3000/index.php
it sends me to
localhost:3000/index. php#
maybe it's the root / and the proxy doesn't work on it?
I try to get the file in another folder
localhost:3000/images/dump.png
again the same
localhost:3000/images/dump.png#
How can I trace what exactly didn't work for me?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question