Jambones REST API server of the jambones platform.
Configuration is provided via environment variables:
A mysql database is used to store long-lived objects such as Accounts, Applications, etc. To create the database schema, use or review the scripts in the 'db' folder, particularly:
- jambones-sql.sql, which creates the schema,
- seed-production-database-open-source.sql, which seeds the database with initial dataset(accounts, permissions, api keys, applications etc).
- create-admin-user.sql, which creates admin user with password set to "admin". The password will be forced to change after the first login.
Note: due to the dependency on the npmjs mysql package, the mysql database must be configured to use sql native authentication.
At this point, if you have followed the above instructions, its simply
npm install
node app
The server will listen by default on port 3000, to change this set the HTTP_PORT environment variable:
HTTP_PORT=4000 node app
To run the included test suite, you will need to have a mysql server installed on your laptop/server. You will need to set the MYSQL_ROOT_PASSWORD env variable to the mysql root password before running the tests. The test suite creates a database named 'jambones_test' in your mysql server to run the tests against, and removes it when done.
MYSQL_ROOT_PASSWORD=foobar npm test
There is a swagger endpoint at http://<your-ip>:3000/swagger that can be used to exercise the APIs. Bearer authentication is required, so you will need an auth token (refer to create-admin-token.sql to see how to generate one).s
