gingko / client

Gingko Writer. Tree-based writing software, written in Elm.
https://gingkowriter.com
MIT License
360 stars 49 forks source link

Help with local project setup #233

Closed tobloef closed 2 years ago

tobloef commented 2 years ago

Hey there. I would really like to contribute to Gingko, but I have hit a wall trying to set up the local version of the app. Most of this applies to both the client and server projects. A few of the things I have done so far:

At this point, I'm running into two (perhaps related) problems:

First of all, I'm not sure what to put in a fair number of the config fields. Especially the ones related to third-party services. How many of those are needed for local development?

My second problem is that I can't seem to use any of the API endpoints, so I can't sign up and use the app. Here's a screenshot, as well as the error I get.

Screenshot 2022-02-09 at 18 59 19
POST http://127.0.0.1:8080/signup 405 (Method Not Allowed)

My best guess is that the client assumes that the API is located on the same domain as the client. I thought I would be able to change this with the config.js file, but I had no luck doing so. I also haven't worked with Elm before, so maybe there's something I'm missing.

I'm curious, what does your local setup look like? Could you perhaps help me set mine up? Perhaps we can improve the documentation based on some of this.

Love the app, and would love to help improve it!

tobloef commented 2 years ago

Here are the changed values of my two config.js files by the way. Slightly edited for security. The API is hosted on port 3000 and the client on port 8080.

Client:

module.exports = {
  TEST_SERVER: "http://localhost:3000",
  COUCHDB_HOST: "localhost",
  COUCHDB_PORT: "5984",
  COUCHDB_SERVER: "localhost:5984",
  COUCHDB_ADMIN_USERNAME: "REDACTED",
  COUCHDB_ADMIN_PASSWORD: "REDACTED",
  // The rest is unchanged
};

Server:

module.exports = {
  COUCHDB_USER: "REDACTED",
  COUCHDB_PASS: "REDACTED",
  URL_ROOT: "http://localhost:3000",
  // The rest is unchanged
};
AdrianoFerrari commented 2 years ago

Try these:

Client:

  TEST_SERVER: "http://localhost:3000",
  COUCHDB_HOST: "localhost",
  COUCHDB_PORT: "5984",
  COUCHDB_SERVER: "http://localhost:3000/db",

Server:

  URL_ROOT: "http://localhost:3000",

3rd-party stuff should just fail silently if it's not enabled. Let me know if that helps.

tobloef commented 2 years ago

Thanks, but I still get the error from before:

POST http://127.0.0.1:8080/signup 405 (Method Not Allowed)

How do you personally host/open the client when running locally? Maybe it's something with the http-server I'm using.

tobloef commented 2 years ago

Ah, I got it πŸ˜… The server hosts the client as well, not just the API. Since it is in two separate projects, I assumed that it needed to be hosted separately as well, but I see now that the server assumes that there's a sibling folder named client.

I get a different kind of error now, but now I can actually get to debug that. Thanks for your patience!

tobloef commented 2 years ago

I got it fully working now πŸŽ‰ I also had to enable the couch_peruser option in CouchDB, but after that, it worked. I can submit a PR, adding what I did to CONTRIBUTING.md, if you want?

AdrianoFerrari commented 2 years ago

Great! Glad you figured it out.

Yes, a PR to Contributing would be very helpful... I forget all the little setup steps that are needed, since it's been so long since I had to do them :slightly_smiling_face: