The API for a better world. More information under human-connection.org
Note: This is only the API part of Human-Connection, you have to also checkout the WebApp which uses this API.
Make sure you have a recent version of docker and docker-compose.
Run:
$ docker-compose up --build
Now, your API should be running at http://localhost:3030 and you can see some contributions at http://localhost:3030/contributions.
For debugging you can run:
$ docker-compose run --rm --service-ports api yarn run dev:debug
And debug your app with Chrome Dev Tools.
Change configuration in config/docker/local-development.json
or
config/docker/local.json
and rerun docker-compose up --build
.
To get an environment which is close to production, run the following:
$ docker-compose -f docker-compose.yml -f docker-compose.staging.yml up --build
Run the entire test suite with:
$ docker-compose run --rm api yarn run test
If you want you can run specific tests:
$ docker-compose run --rm api yarn run mocha
$ docker-compose run --rm api yarn run cucumber
we recommand to install the project locally for the best development ease and performance
Getting up and running is as easy as 1, 2, 3, 4 ... 5.
-
Make sure you have a recent version of NodeJS, yarn and mongoDB installed.
-
Clone this repo
$ git clone https://github.com/Human-Connection/API.git
-
Install your dependencies
$ cd ./API $ yarn
-
Setup database seeder for local development (recommended)
Run
$ cp config/local.example.json config/local.json
-
Setup local mailserver (optional)
Note: You only have to start that mailserver when you want to register, reset your password or test emails in any form, it does not affect the rest of the application.
Install the MailDev server to catch all sent emails in a nice web interface.
# install mail dev (only has to be done once) $ yarn global add maildev # start the server, it will output the web url # which normally is http://localhost:1080 $ maildev
You could also insert your smtp credentials into the local.json but that is not recommended as all emails would be sent to the given addresses which should not happen in development.
-
Start server
You don't have a background process running for mongodb? Just open another terminal and run:
# open up another terminal and run: $ yarn run mongo # or if you are on windows, run: $ yarn run mongo:win
- make sure you have mongo bin directory added to your PATH
Start the API server with the following commands:
$ yarn dev # without hot reload $ yarn start # you can customize the environment like this: $ NODE_ENV=production yarn start
Now, your API should be running at http://localhost:3030. If you seeded your database, you will see some contributions at http://localhost:3030/contributions.
You can override any default configuration in config/local.json
. You can find
a list of availabe defaults in config/default.json
.
See node-config documentation
for details.
E.g. if you want to access the server from your mobile over WiFi, you should
replace localhost
in your settings with your IP address in the local network:
{
"host": "192.168.188.22",
"baseURL": "http://192.168.188.22:3030",
"frontURL": "http://192.168.188.22:3000"
}
Run the entire test suite with:
$ yarn run test
If you want you can run specific tests:
$ yarn run mocha
$ yarn run cucumber
Feathers has a powerful command line interface. Here are a few things it can do:
$ yarn global add feathers-cli # Install Feathers CLI
$ feathers generate service # Generate a new Service
$ feathers generate hook # Generate a new Hook
$ feathers generate model # Generate a new Model
$ feathers help # Show all commands
For more information on all the framework related things visit docs.feathersjs.com.
The HC platform is documented in our gitbook (work in progress).
Copyright (c) 2018 Human-Connection.org
Licensed under the MIT license.