Subdomain in ExpressJS

Florent Source

Good morning everybody!

I'm currently attempting to make a full customized API with NodeJS (using Express) for my Wordpress website.

All was perfect until the authentification process.

I use JWT to auth users, but this process needs to call WP api from my custom API.

The request is as follow:

return new Promise( (resolve, reject) => {'', {
        'username': username,
        'password': password
        .then( (response) => {
        .catch( (error) => {
            let returnedError = [, error.response.status];

It works like a charm in local, but as soon as I upload it to my server, no more response are sent (502 bad gateway). I assume it don't really like to call itself, because here is the arborescence of my server:

  • -- Where all nodeJS files are

  • -- Where all WP files are

So I'm quite sure the app located in don't like to call itself but for path, and I really don't know how to link them without putting everything on the same folder...



comments powered by Disqus