|
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 |
| -## Development |
21 |
| - |
22 |
| -> we recommand to install the project locally for the best development ease and performance |
23 |
| -
|
24 |
| -Getting up and running is as easy as 1, 2, 3, 4 ... 5. |
25 |
| - |
26 |
| -1. Make sure you have [NodeJS](https://nodejs.org/), [yarn](https://yarnpkg.com), [mongoDB](https://www.mongodb.com/download-center#community) installed. |
27 |
| - |
28 |
| -2. Clone this repo |
29 |
| - ``` bash |
30 |
| - $ git clone https://github.com/Human-Connection/API.git |
31 |
| - ``` |
32 |
| - |
33 |
| -3. Install your dependencies |
34 |
| - ``` bash |
35 |
| - $ cd ./API |
36 |
| - $ yarn |
37 |
| - ``` |
38 |
| - |
39 |
| -4. Setup local mailserver (optional) |
40 |
| - |
41 |
| - > **Note:** |
42 |
| - > *You only have to start that mailserver when you want to register, reset your password or test emails in any form, it |
43 |
| - > does not affect the rest of the application.* |
44 |
| - |
45 |
| - Copy `config/local.example.json` to `config/local.json` and install the [MailDev](https://github.com/djfarrelly/MailDev) |
46 |
| - server to catch all sent emails in a nice web interface. |
47 |
| - |
48 |
| - ``` bash |
49 |
| - # install mail dev (only has to be done once) |
50 |
| - $ npm install -g maildev |
51 |
| - |
52 |
| - # start the server, it will output the web url |
53 |
| - # which normally is http://localhost:1080 |
54 |
| - $ maildev |
55 |
| - ``` |
56 |
| - |
57 |
| - You could also insert your smtp credentials into the local.json but that is not recommended as all emails would be sent |
58 |
| - to the given addresses which should not happen in development. |
59 |
| - |
60 |
| -5. Start server |
61 |
| - |
62 |
| - Make sure that the `data` folder exists according to the `mongod --dbpath` in `package.json` to write the data into, then start the server: |
63 |
| - ``` bash |
64 |
| - # start mongodb, feathers and seed database |
65 |
| - $ yarn dev |
66 |
| - $ yarn dev:win if you're on windows |
67 |
| -
|
68 |
| - # start mongodb, feathers without seeding the database |
69 |
| - $ yarn dev:noseed |
70 |
| - |
71 |
| - # start mongodb, feathers for production |
72 |
| - $ yarn start |
73 |
| - ``` |
74 |
| -
|
75 |
| - > ##### IMPORTANT for WIN users: |
76 |
| - > - make sure you have mongo bin directory added to your PATH |
77 |
| - > - if you picked another data directory during mongodb setup make sure |
78 |
| - > to change package.json scripts section for key "dev:win" so it points to |
79 |
| - > the proper path. Otherwise you will get missing data path errors from mongodb. |
80 |
| - |
81 |
| - If you did it right it will seed some fake data for you and downloads some images and avatar for faster development. |
82 |
| - Now you should be able to list some post at [http://localhost:3030/contributions](http://localhost:3030/contributions) |
83 |
| -
|
84 |
| -6. Setup and Start Thumbnail Service (optional) |
85 |
| -
|
86 |
| - We are using [Thumbor](https://github.com/thumbor/thumbor) as a Thumbnail Microservice. |
87 |
| - You can install it locally if you like but this is totally optional. |
88 |
| - |
89 |
| - **Install OR use docker** |
90 |
| - |
91 |
| - - At first you have to [install](http://thumbor.readthedocs.io/en/latest/installing.html) it locally and start it in the console with `thumbor` **OR** run it with docker `docker run -p 8000:8000 apsl/thumbor` |
92 |
| - - Set the `thumbor.url` in `config/local.json` to `http://localhost:8888` (with docker `http://localhost:8000`) if not defined differently. The `thumbor.key` does not necessarily have to be defined, it just makes the URL more secure. |
93 |
| - |
94 |
| - > Do not forget to always start it if you choose that setup or otherwise you will not see any pictures at all. |
95 |
| -
|
96 |
| -## Local configuration |
97 |
| -
|
98 |
| -If you need to configure anything you can do so inside the `config/local.json` file. For that the `config/local.example.json` will contain always a minimal setup to get it working. |
99 |
| -
|
100 |
| -If, f.ex., you want to change listen address, port or URL, you can do so. Entries in the `config/local.json` will override entries in the `config/default.json`. |
101 |
| -
|
102 |
| -**Note on the seeder configuration** |
103 |
| -The seeder configuration has two properties: |
104 |
| -- **dropDatabase:** drop the whole database on (re)start. |
105 |
| -- **runOnInit:** run the seeder always on server (re)start (when database is empty). |
106 |
| -
|
107 |
| -> **Note** *You can switch the `dropDatabase` entry after seeding and it will persist the seeded data.* |
108 |
| -
|
109 |
| -## Testing |
110 |
| -
|
111 |
| -Simply run `yarn test` and all your tests in the `test/` directory will be run. |
112 |
| -
|
113 |
| -## Scaffolding |
114 |
| -
|
115 |
| -Feathers has a powerful command line interface. Here are a few things it can do: |
116 |
| -
|
117 |
| -``` bash |
118 |
| -$ npm install -g feathers-cli # Install Feathers CLI |
119 |
| -
|
120 |
| -$ feathers generate service # Generate a new Service |
121 |
| -$ feathers generate hook # Generate a new Hook |
122 |
| -$ feathers generate model # Generate a new Model |
123 |
| -$ feathers help # Show all commands |
124 |
| -``` |
| 15 | +This is the backend of HC.<br /> |
| 16 | +It uses the FeathersJS, NodeJS, yarn and mongoDB.<br /> |
125 | 17 |
|
126 | 18 | ## Help
|
127 |
| -
|
128 |
| -For more information on all the framework related things visit [docs.feathersjs.com](http://docs.feathersjs.com). |
129 |
| -
|
130 |
| -The HC platform is documented in our [gitbook](https://www.gitbook.com/book/human-connection/documentation/) (work in progress). |
| 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 /> |
131 | 21 |
|
132 | 22 | ## License
|
133 |
| -
|
134 |
| -Copyright (c) 2018 [Human-Connection.org](https://human-connection.org) |
135 |
| -
|
136 |
| -Licensed under the [MIT](https://github.com/Human-Connection/WebApp/blob/develop/LICENSE.md) 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