|
12 | 12 | </p>
|
13 | 13 |
|
14 | 14 | # Human-Connection API
|
15 |
| - |
16 |
| -The API for a better world. More information under [human-connection.org](https://human-connection.org) |
17 |
| - |
18 |
| -> **Note:** This is only the API part of Human-Connection, you have to also checkout the [WebApp](https://github.com/Human-Connection/WebApp) which uses this API. |
19 |
| -
|
20 |
| -## Installation via docker |
21 |
| - |
22 |
| -Make sure you have a recent version of [docker](https://www.docker.com/) and [docker-compose](https://docs.docker.com/compose/). |
23 |
| - |
24 |
| -Run: |
25 |
| -```bash |
26 |
| -$ docker-compose up --build |
27 |
| -``` |
28 |
| -Now, your API should be running at [http://localhost:3030](http://localhost:3030) |
29 |
| -and you can see some contributions at [http://localhost:3030/contributions](http://localhost:3030/contributions). |
30 |
| - |
31 |
| -For debugging you can run: |
32 |
| -```bash |
33 |
| -$ docker-compose run --rm --service-ports api yarn run dev:debug |
34 |
| -``` |
35 |
| -And debug your app with [Chrome Dev Tools](chrome://inspect). |
36 |
| - |
37 |
| -### Configuration in Docker |
38 |
| - |
39 |
| -Change configuration in `config/docker/local-development.json` or |
40 |
| -`config/docker/local.json` and rerun `docker-compose up --build`. |
41 |
| - |
42 |
| -#### Local Staging Environment |
43 |
| - |
44 |
| -To get an environment which is close to production, run the following: |
45 |
| -```sh |
46 |
| -$ docker-compose -f docker-compose.yml -f docker-compose.staging.yml up --build |
47 |
| -``` |
48 |
| - |
49 |
| -### Testing in Docker |
50 |
| - |
51 |
| -Run the entire test suite with: |
52 |
| -```bash |
53 |
| -$ docker-compose run --rm api yarn run test |
54 |
| -``` |
55 |
| - |
56 |
| -If you want you can run specific tests: |
57 |
| -```bash |
58 |
| -$ docker-compose run --rm api yarn run mocha |
59 |
| -$ docker-compose run --rm api yarn run cucumber |
60 |
| -``` |
61 |
| - |
62 |
| - |
63 |
| -## Local installation |
64 |
| - |
65 |
| -> we recommand to install the project locally for the best development ease and performance |
66 |
| -
|
67 |
| -Getting up and running is as easy as 1, 2, 3, 4 ... 5. |
68 |
| - |
69 |
| -1. Make sure you have a recent version of [NodeJS](https://nodejs.org/), [yarn](https://yarnpkg.com) and [mongoDB](https://www.mongodb.com/download-center#community) installed. |
70 |
| - |
71 |
| -2. Clone this repo |
72 |
| - ``` bash |
73 |
| - $ git clone https://github.com/Human-Connection/API.git |
74 |
| - ``` |
75 |
| - |
76 |
| -3. Install your dependencies |
77 |
| - ``` bash |
78 |
| - $ cd ./API |
79 |
| - $ yarn |
80 |
| - ``` |
81 |
| -4. Setup database seeder for local development (recommended) |
82 |
| - |
83 |
| - Run |
84 |
| - ```sh |
85 |
| - $ cp config/local.example.json config/local.json |
86 |
| - ``` |
87 |
| - |
88 |
| -5. Setup local mailserver (optional) |
89 |
| - |
90 |
| - > **Note:** |
91 |
| - > *You only have to start that mailserver when you want to register, reset your password or test emails in any form, it |
92 |
| - > does not affect the rest of the application.* |
93 |
| -
|
94 |
| - Install the [MailDev](https://github.com/djfarrelly/MailDev) |
95 |
| - server to catch all sent emails in a nice web interface. |
96 |
| - |
97 |
| - ``` bash |
98 |
| - # install mail dev (only has to be done once) |
99 |
| - $ yarn global add maildev |
100 |
| - |
101 |
| - # start the server, it will output the web url |
102 |
| - # which normally is http://localhost:1080 |
103 |
| - $ maildev |
104 |
| - ``` |
105 |
| - |
106 |
| - You could also insert your smtp credentials into the local.json but that is not recommended as all emails would be sent |
107 |
| - to the given addresses which should not happen in development. |
108 |
| - |
109 |
| -6. Start server |
110 |
| - |
111 |
| - You don't have a background process running for mongodb? |
112 |
| - Just open another terminal and run: |
113 |
| - |
114 |
| - ```bash |
115 |
| - # open up another terminal and run: |
116 |
| - $ yarn run mongo |
117 |
| - # or if you are on windows, run: |
118 |
| - $ yarn run mongo:win |
119 |
| - ``` |
120 |
| - > ##### IMPORTANT for Windows users: |
121 |
| - > - make sure you have mongo bin directory added to your PATH |
122 |
| -
|
123 |
| - Start the API server with the following commands: |
124 |
| - ``` bash |
125 |
| - $ yarn dev |
126 |
| - |
127 |
| - # without hot reload |
128 |
| - $ yarn start |
129 |
| - # you can customize the environment like this: |
130 |
| - $ NODE_ENV=production yarn start |
131 |
| - ``` |
132 |
| - |
133 |
| - |
134 |
| - Now, your API should be running at [http://localhost:3030](http://localhost:3030). |
135 |
| - If you seeded your database, you will see some contributions at [http://localhost:3030/contributions](http://localhost:3030/contributions). |
136 |
| - |
137 |
| - |
138 |
| -### Local Configuration |
139 |
| - |
140 |
| -You can override any default configuration in `config/local.json`. You can find |
141 |
| -a list of availabe defaults in `config/default.json`. |
142 |
| -See [node-config documentation](https://github.com/lorenwest/node-config/wiki/Configuration-Files) |
143 |
| -for details. |
144 |
| - |
145 |
| -E.g. if you want to access the server from your mobile over WiFi, you should |
146 |
| -replace `localhost` in your settings with your IP address in the local network: |
147 |
| -```json |
148 |
| -{ |
149 |
| - "host": "192.168.188.22", |
150 |
| - "baseURL": "http://192.168.188.22:3030", |
151 |
| - "frontURL": "http://192.168.188.22:3000" |
152 |
| -} |
153 |
| - |
154 |
| -``` |
155 |
| - |
156 |
| -### Local Testing |
157 |
| - |
158 |
| -Test Logins |
159 |
| - |
160 |
| -| Role | E-Mail | Password | |
161 |
| -| --------- | -------------- | -------- | |
162 |
| -| Admin | [email protected] | 1234 | |
163 |
| -| Moderator | [email protected] | 1234 | |
164 |
| -| User | [email protected] | 1234 | |
165 |
| - |
166 |
| - |
167 |
| -Run the entire test suite with: |
168 |
| -```bash |
169 |
| -$ yarn run test |
170 |
| -``` |
171 |
| - |
172 |
| -If you want you can run specific tests: |
173 |
| -```bash |
174 |
| -$ yarn run mocha |
175 |
| -$ yarn run cucumber |
176 |
| -``` |
177 |
| - |
178 |
| - |
179 |
| -## Scaffolding |
180 |
| - |
181 |
| -Feathers has a powerful command line interface. Here are a few things it can do: |
182 |
| - |
183 |
| -``` bash |
184 |
| -$ yarn global add feathers-cli # Install Feathers CLI |
185 |
| - |
186 |
| -$ feathers generate service # Generate a new Service |
187 |
| -$ feathers generate hook # Generate a new Hook |
188 |
| -$ feathers generate model # Generate a new Model |
189 |
| -$ feathers help # Show all commands |
190 |
| -``` |
| 15 | +This is the backend of HC.<br /> |
| 16 | +It uses the FeathersJS, NodeJS, yarn and mongoDB.<br /> |
191 | 17 |
|
192 | 18 | ## Help
|
| 19 | +The HC platform and its setup is documented in our [docs](https://docs.human-connection.org/) (work in progress).<br /> |
| 20 | +Connect with other developers over [Discord](https://discord.gg/6ub73U3)<br /> |
193 | 21 |
|
194 |
| -For more information on all the framework related things visit [docs.feathersjs.com](http://docs.feathersjs.com). |
195 |
| - |
196 |
| -The HC platform is documented in our [gitbook](https://www.gitbook.com/book/human-connection/documentation/) (work in progress). |
197 |
| - |
198 |
| -Connect with other developers over [Discord](https://discord.gg/mVmjvNF). |
199 |
| - |
200 |
| -## License |
201 |
| - |
202 |
| -Copyright (c) 2018 [Human-Connection.org](https://human-connection.org) |
203 |
| - |
204 |
| -Licensed under the [MIT](https://github.com/Human-Connection/WebApp/blob/develop/LICENSE.md) license. |
| 22 | +## License |
| 23 | +Copyright (c) 2018 [Human-Connection.org](https://human-connection.org)<br /> |
| 24 | +Licensed under the [MIT](https://github.com/Human-Connection/WebApp/blob/develop/LICENSE.md) license.<br /> |
0 commit comments