Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit 385380d

Browse files
committed
Merge remote-tracking branch 'origin/develop' into blacklist_feature
2 parents d305d1c + bf3f51b commit 385380d

10 files changed

+164
-245
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ node_modules
3434
.classpath
3535
.c9/
3636
.vscode
37+
/.vs
3738
*.launch
3839
.settings/
3940
*.sublime-workspace
@@ -123,3 +124,4 @@ rethinkdb_data
123124
.env
124125
/config/local.json
125126
package-lock.json
127+
/.github

README.md

Lines changed: 7 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -12,193 +12,13 @@
1212
</p>
1313

1414
# 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 />
19117

19218
## 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 />
19321

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 />

config/default-docker.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"baseURL": "http://api.127.0.0.1.xip.io:3030",
23
"mongodb": "mongodb://mongo:27017/hc_api",
34
"host": "0.0.0.0"
45
}

config/local-staging-docker.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{
2-
"baseURL": "http://172.25.0.11:3030",
32
"seeder": {
43
"runOnInit": true,
5-
"dropDatabase": true
4+
"dropDatabase": false
65
},
76
"smtpConfig": {
87
"host": "maildev",
98
"port": 25,
109
"ignoreTLS": true
1110
},
1211
"thumbor": {
13-
"url": "http://localhost:8000",
12+
"url": "http://thumbor.127.0.0.1.xip.io:8000",
1413
"key": ""
1514
}
1615
}

docker-compose.override.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3'
1+
version: '3.5'
22

33
services:
44
api:

docker-compose.staging.yml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
version: '3'
1+
version: '3.5'
22

33
services:
44
api:
5-
container_name: api_api
6-
hostname: api_api
75
image: humanconnection/api-feathers:edge
86
build:
97
context: .
@@ -18,8 +16,6 @@ services:
1816
- hc-network
1917

2018
maildev:
21-
container_name: api_maildev
22-
hostname: api_maildev
2319
image: djfarrelly/maildev
2420
networks:
2521
- hc-network
@@ -28,25 +24,9 @@ services:
2824
- "1025:25"
2925

3026
thumbor:
31-
container_name: api_thumbor
32-
hostname: api_thumbor
27+
container_name: thumbor.127.0.0.1.xip.io
3328
image: apsl/thumbor
3429
networks:
3530
- hc-network
3631
ports:
3732
- "8000:8000"
38-
39-
dns-proxy-server:
40-
image: defreitas/dns-proxy-server
41-
volumes:
42-
- "/var/run/docker.sock:/var/run/docker.sock"
43-
- "/etc/resolv.conf:/etc/resolv.conf"
44-
ports:
45-
- 5380:5380
46-
hostname: dns.mageddo
47-
48-
networks:
49-
hc-network:
50-
driver: bridge
51-
ipam:
52-
driver: default

docker-compose.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
1-
version: '3'
1+
version: '3.5'
22

33
services:
44
api:
5+
container_name: api.127.0.0.1.xip.io
56
build: .
67
depends_on:
78
- mongo
89
networks:
910
- hc-network
11+
1012
mongo:
1113
image: mongo
1214
networks:
1315
- hc-network
1416
command: "--smallfiles --logpath=/dev/null"
1517

18+
# dns-proxy-server:
19+
# image: defreitas/dns-proxy-server
20+
# volumes:
21+
# - "/var/run/docker.sock:/var/run/docker.sock"
22+
# - "/etc/resolv.conf:/etc/resolv.conf"
23+
# - "./dns-proxy-server.config.json:/app/conf/config.json"
24+
# ports:
25+
# - 5380:5380
26+
# hostname: dns.mageddo
27+
# networks:
28+
# - hc-network
29+
1630
networks:
1731
hc-network:
32+
name: hc-network

features/api/usersettings.feature

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Feature: Save current newsfeed filters to usersettings
2+
As a user of human connection
3+
You would like to have my latest newsfeed filter settings saved
4+
In order to see the same selection of content next time I log in
5+
6+
Background:
7+
Given this is your user account:
8+
| email | password | isVerified |
9+
| user@example.com | 1234 | true |
10+
11+
Scenario: Save your language
12+
Given you are authenticated
13+
When you create your user settings via POST request to "/usersettings" with:
14+
"""
15+
{
16+
"uiLanguage": "de"
17+
}
18+
"""
19+
Then your language "de" is stored in your user settings
20+
21+
Scenario: Save your filter settings
22+
Given you are authenticated
23+
When you create your user settings via POST request to "/usersettings" with:
24+
"""
25+
{
26+
"contentLanguages" : [ "en" ],
27+
"uiLanguage" : "en",
28+
"filter": {
29+
"categoryIds": [
30+
"5b310ab8b801653c1eb6c426",
31+
"5b310ab8b801653c1eb6c427",
32+
"5b310ab8b801653c1eb6c428"
33+
]
34+
}
35+
}
36+
"""
37+
Then these category ids are stored in your user settings

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@
6363
"crypto-js": "^3.1.9-1",
6464
"dauria": "~2.0.0",
6565
"email-templates": "2.6.0",
66-
"feathers-authentication-hooks": "~0.3.0",
66+
"feathers-authentication-hooks": "~0.3.1",
6767
"feathers-authentication-management": "~2.0.1",
6868
"feathers-blob": "~2.0.1",
6969
"feathers-hooks-common": "~4.14.3",
7070
"feathers-logger": "0.3.2",
7171
"feathers-mailer": "~2.0.0",
7272
"feathers-memory": "~2.1.3",
73-
"feathers-mongodb": "~3.2.0",
73+
"feathers-mongodb": "~3.3.0",
7474
"feathers-mongodb-fuzzy-search": "~1.1.1",
7575
"feathers-mongoose": "~6.1.2",
7676
"feathers-profiler": "^0.1.5",
@@ -103,7 +103,7 @@
103103
"babel-eslint": "~8.2.6",
104104
"chai": "^4.1.2",
105105
"cucumber": "^4.2.1",
106-
"concurrently": "~3.6.1",
106+
"concurrently": "~4.0.1",
107107
"cross-env": "^5.2.0",
108108
"eslint": "~4.19.1",
109109
"istanbul": "1.1.0-alpha.1",

0 commit comments

Comments
 (0)