web: split up into REST api server and a js client #316

Open
TomK32 opened this Issue Jan 8, 2016 · 6 comments

Projects

None yet

2 participants

@TomK32
Contributor
TomK32 commented Jan 8, 2016 edited

I had a look through old issues concerning hledger-web and little progress seems to be made, and my limited knowledge of haskell keeps me from doing more for it. Which is why I'd like to propose a very radical step:

  • Cut down the yesod app to serve as a REST API
  • Move all logic and templates into a javascript app (i don't care wether we use Angular, Backbone or Ember)

This move would bring the web-clients language to the browsers native language javascript, allowing easier modifications for the plenty numbers of javascript programmers out there. Logic and view templates could be separated far better than they are right now. For remaining server, a wider and purer REST api would allow inter-machine JSON requests, imagine a POS or webshop sending details about your sales directly into your bookkeeping!

For reference, there's an unfinished(?) project to do the same for ledger using python and AngularJS: https://groups.google.com/forum/#!msg/ledger-cli/2gRLc9kCPCc/Cw_4KG1dJqwJ -- source -- docs

and another old project, for ledger: https://github.com/slashdotdash/node-ledger-web


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@simonmichael
Owner

Yes, this has been on the wishlist for a long time. I'm leaning towards this approach: create a new hledger-api package containing

  1. a series of simple example client-side web apps
  2. the simplest possible web API server (I'm trying to avoid misusing "REST" here) that makes them work. I'd give servant a try.

The examples should always work, and drive the evolution of the server.

@simonmichael
Owner

We now have a minimal API server and client-side example. Please build more examples/apps and let me know what API methods you need added to the server (pull requests for that also welcome).

@TomK32 TomK32 added a commit to TomK32/hledger that referenced this issue Jan 11, 2016
@TomK32 TomK32 Start client app using AngularJS #316 cc97ae9
@TomK32 TomK32 added a commit to TomK32/hledger that referenced this issue Jan 11, 2016
@TomK32 TomK32 Would actually list the accounts in web-ui if it wasn't for cross-sit…
…e-protection #316
a529c74
@TomK32 TomK32 added a commit to TomK32/hledger that referenced this issue Jan 11, 2016
@TomK32 TomK32 Start using bootstrap css for web-ui #316 e82c6e0
@TomK32
Contributor
TomK32 commented Jan 12, 2016

I'd prever /accounts to return a tree like this:

[
  {"name": "Assets",
    "children": [
      {"name": "TownBank",
       "children": [
          {"name": "Checking"}
       ]
      },
      { "name": "CreditCard"}
    ]
  },
  {"name": "Liabilities"},
]
@TomK32
Contributor
TomK32 commented Jan 12, 2016

The next resource i need is the balances for an account.
GET /accounts/Expenses:Food/balances
to return

[
  { "name": "USD", "amount": 200 },
  { "name": "", "amount": 440 }
]
@TomK32 TomK32 added a commit to TomK32/hledger that referenced this issue Jan 12, 2016
@TomK32 TomK32 List accounts in a recursive tree #316 912837a
@TomK32 TomK32 added a commit to TomK32/hledger that referenced this issue Jan 12, 2016
@TomK32 TomK32 Start client app using AngularJS #316 88d8f97
@TomK32 TomK32 added a commit to TomK32/hledger that referenced this issue Jan 12, 2016
@TomK32 TomK32 Would actually list the accounts in web-ui if it wasn't for cross-sit…
…e-protection #316
2e625fd
@TomK32 TomK32 added a commit to TomK32/hledger that referenced this issue Jan 12, 2016
@TomK32 TomK32 Start using bootstrap css for web-ui #316 4b9f03a
@TomK32 TomK32 added a commit to TomK32/hledger that referenced this issue Jan 12, 2016
@TomK32 TomK32 List accounts in a recursive tree #316 39682a0
@TomK32 TomK32 added a commit to TomK32/hledger that referenced this issue Jan 18, 2016
@TomK32 TomK32 api: Client sidebar looks okay for now #316 2e8da54
@TomK32
Contributor
TomK32 commented Jan 19, 2016

Okay, I did some work on my fork, sidebar with the accounts is a happy little sidebar now. What's not working yet is the transactions for one account. either we change /api/v1/accounts/:name to return a hash rather than an array or we rename it to /api/v1/accounts/:name/transaction. I'd be happy with either.

@simonmichael
Owner

I've merged your latest to hledger/master, with some cleanups - thanks.

Let's chat more about the api needs on #hledger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment