Skip to content

Commit 6807090

Browse files
committed
add it in a state where backend integration-tests are running and mock users are created
1 parent 2d64601 commit 6807090

28 files changed

+3988
-203
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.idea/

.idea/workspace.xml

Lines changed: 253 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Bookmarks Manager for Developers & Co
2+
Bookmarks.dev is a bookmark manager created and designed primarily for Developers & Co. It helps you [save time and nerves
3+
when managing your dev bookmarks](https://dev.to/ama/how-i-manage-my-dev-bookmarks-and-save-time-and-nerves-56ae) and eases
4+
[bookmarking of code snippets via Codelets](https://dev.to/ama/bookmarking-code-snippets-with-codelets-3d44). Check our
5+
[HowTo](https://www.bookmarks.dev/howto) page to help you get started.
6+
7+
Most worthy public bookmarks are published regularly on Github in a [separate repository](https://github.com/CodepediaOrg/bookmarks).
8+
9+
## Getting started
10+
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
11+
12+
The project is developed with the MEAN stack and [Keycloak](http://www.keycloak.org/) for authentication and authorization:
13+
![components-graph](documentation/graphviz/components-graph.png)
14+
15+
The project contains two parts
16+
* [frontend](frontend) which makes up the User Interface. This uses with Angular and Angular CLI.
17+
* [backend](backend) which is the API supporting the UI. This uses ExpressJS with MongoDB and Keycloak.
18+
19+
### Prerequisites
20+
21+
What you need to run this app:
22+
* `node` and `npm` (we recommend using [NVM](https://github.com/creationix/nvm))
23+
* Ensure you're running Node at least (`v6.x.x`+) and NPM (`3.x.x`+)
24+
* [nodemon](https://nodemon.io/) - `npm install -g nodemon`
25+
* **Docker** - we recommend using [Docker Desktop](https://www.docker.com/products/docker-desktop)
26+
27+
> Docker and Docker-compose are currently used only for local development
28+
29+
### Installing (development setup)
30+
31+
#### Start MongoDB and Keycloak server
32+
33+
```bash
34+
docker-compose up
35+
```
36+
> Use `-d` to run it in the background
37+
38+
#### Create a test user (2 min)
39+
You need to create a test user in Keycloak first.
40+
Follow the screenshots in [Add a Keycloak user](documentation/keycloak/add-keycloak-user.md) to create it.
41+
42+
#### Install and run backend
43+
```shell
44+
# install
45+
cd backend
46+
nvm use
47+
npm install
48+
49+
# run
50+
npm run debug
51+
```
52+
or in one line `cd backend; nvm use; npm install; npm run debug`
53+
54+
This will start the API with [nodemon](http://nodemon.io) at [http://localhost:3000/api](http://localhost:3000/api) and will watch for code changes and automatically redeploy.
55+
56+
> To be able to automatically add youtube videos published date and duration to the title you need to
57+
create a _nodemon.json_ file based on the [nodemon.json.example](nodemon.json.example) and a real youtube api key
58+
59+
#### Install and run frontend
60+
```shell
61+
# install
62+
cd frontend
63+
nvm use
64+
npm install
65+
66+
# run
67+
ng serve
68+
```
69+
or in one line `cd frontend; nvm use; npm install; ng serve`
70+
71+
A step by step series of examples that tell you how to get a development env running
72+
* [backend](backend/README.md) - `cd backend; docker-compose up; nvm use; npm install; npm run debug`
73+
* [frontend](frontend/README.md) - TLDR `cd frontend; nvm use; npm install; ng serve`
74+
75+
#### Backend
76+
77+
## Contributing
78+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
79+
80+
## Versioning
81+
82+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/CodepediaOrg/bookmarks.dev/tags).
83+
84+
## License
85+
86+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

backend/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ nodemon.json
4545
# pm2 prod setup
4646
pm2-process.json
4747

48-
/docs/keycloak/get-access-token.local-dev.md
48+
/documentation/keycloak/get-access-token.local-dev.md

backend/README.md

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Back-end REST API for [www.bookmarks.dev](http://www.bookmarks.dev).
88
* [Angular](https://angular.io/docs/ts/latest/)
99
* [NodeJS](https://nodejs.org/en/docs/)
1010
* [Keycloak](http://www.keycloak.org/) for authentication and authorization:
11-
11+
1212
![components-graph](docs/graphviz/components-graph.png)
13-
13+
1414
> The production setup is can be found here - [components production](https://raw.githubusercontent.com/wiki/CodepediaOrg/bookmarks-api/images/network-diagram.png)
1515
***
1616

17-
## Getting Started
17+
## Getting Started
1818

1919
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
2020
See deployment for notes on how to deploy the project on a live system.
@@ -31,20 +31,6 @@ What you need to run this app:
3131

3232
A step by step series of examples that tell you how to get a development env running
3333

34-
#### Start MongoDB and Keycloak server
35-
36-
```bash
37-
docker-compose up
38-
39-
OR
40-
41-
docker-compose up -d # if you want it to run in the background
42-
```
43-
44-
#### Create a Keycloak user (2 min)
45-
To test with the front-end [bookmarks.dev](https://github.com/CodepediaOrg/bookmarks.dev) create a Keycloak test user.
46-
Follow the screenshots in [Add a Keycloak user](docs/keycloak/add-keycloak-user.md) to create it.
47-
4834
#### Start the development server (API)
4935

5036
```bash
@@ -53,14 +39,9 @@ npm install
5339
npm run debug
5440
```
5541

56-
This will start the API with [nodemon](http://nodemon.io) and will watch for code changes and automatically redeploy.
57-
58-
> To be able to automatically add youtube videos published date and duration to the title you need to
59-
create a _nodemon.json_ file based on the [nodemon.json.example](nodemon.json.example) and a real youtube api key
60-
6142
#### Debugging
6243

63-
##### IntelliJ / Wegstorm (Node.js plugin is required)
44+
##### IntelliJ / Webstorm (Node.js plugin is required)
6445
The ``npm run debug`` starts nodemon with the `--inspect` parameter so you can attach to this process, by using the following configuration:
6546
![nodejs-remote-debugging](docs/debugging/attach-to-nodemon-process.png)
6647

@@ -70,7 +51,7 @@ See [Node.js debugging in VS Code with Nodemon](https://github.com/microsoft/vsc
7051

7152

7253
#### Get Keycloak access token via API call
73-
To get a keycloak access token via API call see [Get Access Token from Keycloak via API call](docs/keycloak/get-access-token.md)
54+
To get a keycloak access token via API call see [Get Access Token from Keycloak via API call](../documentation/keycloak/get-access-token.md)
7455

7556
## Testing
7657

@@ -90,7 +71,7 @@ A report will be generated.
9071

9172
The API has an OpenAPI specification available at [docs/openapi/openapi.yaml](docs/openapi/openapi.yaml)
9273

93-
Based on that a GUI is generated to test the API directly from browser:
74+
Based on that a GUI is generated to test the API directly from browser:
9475
* [local](http://localhost:3000/api/docs)
9576
* [production](https://www.bookmarks.dev/api/docs)
9677

@@ -115,17 +96,6 @@ pm2 restart pm2-process.json --env production
11596
pm2 stop pm2-process.json --env production
11697
```
11798

118-
## Contributing
119-
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
120-
121-
## Versioning
122-
123-
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/CodepediaOrg/bookmarks.dev-api/tags).
124-
125-
## License
126-
127-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
128-
12999

130100

131101
## Appendix

backend/docker-compose.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

backend/package-lock.json

Lines changed: 23 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/src/routes/admin/admin.router.spec.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ describe('Admin API Tests', function () {
2424
//set admin bearer token
2525
const response = await superagent
2626
.post(config.integration_tests.token_endpoint)
27-
.send('client_id=' + config.integration_tests.admin.client_id)
28-
.send('client_secret=' + config.integration_tests.admin.client_secret)
29-
.send('grant_type=client_credentials')
27+
.send('client_id=' + 'bookmarks')
28+
.send('username=' + 'admin-integration-tests')//TODO change me
29+
.send('password=' + 'admin-integration-tests')
30+
.send('grant_type=password')
3031
.set('Accept', 'application/json');
3132

3233
adminBearerToken = 'Bearer ' + response.body.access_token;

backend/docker-compose-setup/docker-compose-with-node-not-working-403-forbidden.yml renamed to docker-compose-setup/archive/docker-compose-with-node-not-working-403-forbidden.yml

File renamed without changes.

0 commit comments

Comments
 (0)