mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 13:26:51 +00:00
An open source RESTful API platform for banks that supports Open Banking, XS2A and PSD2 through access to accounts, transactions, counterparties, payments, entitlements and metadata - plus a host of internal banking and management APIs.
| MavLift | ||
| .gitignore | ||
| MongoRecordExamplesSpec.scala | ||
| README | ||
| scala_snippets.txt | ||
This project contains some try outs so far.
The project is using sbt or Maven 2 as a build tool. See build.scala or pom.xml respectively for the dependencies.
I used IntelliJ IDEA as my IDE. It has nice autocompletion.
----
To compile and run jetty, cd into the root directory (where this file is) and run:
$ sbt
...
> compile
> ~;container:start; container:reload /
(Note that you first have to start sbt and then on its console start jetty with the container:start task, otherwise it will exit immediately. More here: https://github.com/siasia/xsbt-web-plugin/wiki)
In OS X, sbt can be installed with $ sudo port install sbt
----
Alternatively, maven can also be used:
mvn jetty:run
Note: You may need to add the pluginGroup to the $HOME/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
...
<pluginGroups>
<pluginGroup>org.mortbay.jetty</pluginGroup>
</pluginGroups>
...
</settings>
----
To test one of the URL's use:
curl http://localhost:8080/mongodb
Other important files:
Boot.scala
SomeThing.scala - This file contains the URL routes (like urls.py) and my try outs- See serve case Req
----
I tried several approaches for scala talking to mongodb
Lift Record: works for inserts and simple (inc geo) queries. but i couldn't figure out how to sort.
Rogue: I got this to import but couldn't get the "where" syntax to compile.
Casbah: works including sorting. :-)
Casbah is the officialy supported Scala driver for MongoDB. It is a thin wrapper for the Java driver which is very well used
so I guess its a good choice at least until we understand how to use Lift Record/ Rogue better.
We can still use Lift Record for inserts etc.
It also has a full time developer working on it. The documentation tends to lack examples, but this helps:
https://github.com/mongodb/casbah/blob/master/casbah-query/src/test/scala/DSLCoreOperatorsSpec.scala#L861-984
You'll also need to add the import statement to get the query syntax:
import com.mongodb.casbah.query.Imports._
To start mongodb
sudo mongod
Note: you might want to look at the mongo data from the mongo command line:
db.chooseitems.find( { location : { $near : [2,2] } } )
etc.
s.r.