So im trying to get a call from my react client to my node api. With postman I can have results but with react on submit im having an error 500 and i have no idea what im doing wrong. Both clients are on my machine, nodeapi running on port 8000 and react client running on port 3000. Any help?

```
import React, { Component } from "react";
import axios from "axios";

export class Login extends Component {
  constructor(props) {
    super(props);
    this.state = {
      email: "",
      password: ""
    };

    this.change = this.change.bind(this);
    this.submit = this.submit.bind(this);
  }

  change(e) {
    this.setState({
      [e.target.name]: e.target.value
    });
  }

  submit(e) {
    e.preventDefault();
    axios
      .post("http://localhost:8000/api/users", {
        email: this.state.email,
        password: this.state.password
      })
      .then(res => localStorage.setItem("cool-jwt", res.data));
  }

  render() {
    return (
      <div>
        <form onSubmit={e => this.submit(e)}>
          <label>email</label>
          <input
            type="text"
            name="email"
            onChange={e => this.change(e)}
            value={this.state.email}
          />
          <label>password</label>
          <input
            type="text"
            name="password"
            onChange={e => this.change(e)}
            value={this.state.password}
          />
          <button type="submit">Submit</button>
        </form>
      </div>
    );
  }
}

export default Login;

```

```
//POST new user route (optional, everyone has access)
router.post('/', auth.optional, (req, res, next) => {
    const {
        body: {
            user
        }
    } = req;

    if (!user.email) {
        return res.status(422).json({
            errors: {
                email: 'is required',
            },
        });
    }

    if (!user.password) {
        return res.status(422).json({
            errors: {
                password: 'is required',
            },
        });
    }

    const finalUser = new Users(user);

    finalUser.setPassword(user.password);

    return finalUser.save()
        .then(() => res.json({
            user: finalUser.toAuthJSON()
        }));
});

```

Doing POST on postman from this link <http://localhost:8000/api/users>
with this parameters: 

```
{
  "user": {
    "email": "myemailo@email",
    "password": "mypassword"
  }
}

```

I get this:

```
{
    "user": {
        "_id": "5d00d9ed47566f7938a91a3d",
        "email": "myemailo@email",
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im15ZW1haWxvQGVtYWlsIiwiaWQiOiI1ZDAwZDllZDQ3NTY2Zjc5MzhhOTFhM2QiLCJleHAiOjE1NjU1MjA4NzcsImlhdCI6MTU2MDMzNjg3N30.ZG7vzNFoUqj_c3YcrJloeGZiORSRg0N1yVPhAvlejCs"
    }
}

```

But trying on react im having error 500. Any help?