hoodie-server
is the core server component of Hoodie. Together with hoodie-client
, it forms the two parts that make up the Hoodie system.
hoodie-server
is responsible for a number of things on the server:
- check the environment to make sure Hoodie can run properly
- start an instance of CouchDB, Hoodie’s database
- start a webserver each for the Hoodie app itself and the Hoodie Admin Dashboard
- start all Hoodie plugins that might be installed
hoodie-server
isn’t meant to be used by itself and it is used by the hoodie
module, which also inlcude hoodie-client
to form Hoodie.
You can use hoodie-server
on its own, if you want to work on it, help fix bugs or test new versions. And when you are writing your own plugin, you can use hoodie-server
for debugging.
As noted before, this isn’t meant to be run standalone, but if you are helping out with development, or build your own plugins, or just want to spelunk around, here’s how it works:
git clone git@github.com:hoodiehq/hoodie-server.git
cd hoodie-server
npm install
When that’s done, you can run ./bin/start
to start hoodie-server
. Usually, hoodie-server
is run within the context of an existing frontend application, but when you run it alone, it will use its www/
directory to serve the web app. For now, this is just a simple index.html
file that says hi
.
There are a few options to change the behaviour of hoodie-server
. See a list by running ./bin/start --help
. It looks something like this:
Usage: npm start -- [options]
Options:
--www Set www root directory
--custom-ports Provide custom ports www,admin,couchdb
--in-memory Use a pure in-memory database which will be deleted upon restart
--help Show usage information
--loglevel Set the loglevel [default: "warn"]
--silly Set the loglevel to silly
--verbose Set the loglevel to verbose
--info Set the loglevel to info
--http Set the loglevel to http
--warn Set the loglevel to warn
--error Set the loglevel to error
--silent Set the loglevel to silent
If that doesn’t make much sense just yet, don’t worry about it.
The hoodie-server
test suite is run with npm test
.
The tests live in test/unit
and test/integration
. test/unit
tests (or “unit tests”) are to test the behaviour of individual sub-modules within hoodie-server
, while test/integration
tests (or “integration tests”) are used to test the behaviour of a fully running instance of hoodie-server
, e.g. the behaviour of its HTTP API.
If you are adding new features to hoodie-server
you should provide test cases for the new feature. Depending on the feature, you either best write unit tests or integration tests and sometimes even both. The more tests we have, the more confidently we can release future versions of hoodie-server
.
// how to ask for support // chat // issues // how to file bug reports
// point to hoodie/CONTRIBUTING.md
Apache 2 548A .0