Bookmarks.dev-API
Back-end REST API for www.bookmarks.dev.
Built With
The production setup is can be found here - components production
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Prerequisites
What you need to run this app:
node
andnpm
(we recommend using NVM)- Ensure you're running Node at least (
v6.x.x
+) and NPM (3.x.x
+)
- Ensure you're running Node at least (
- nodemon -
npm install -g nodemon
- Docker - we recommend using Docker Desktop
Installing (development setup)
A step by step series of examples that tell you how to get a development env running
Start MongoDB and Keycloak server
docker-compose up
OR
docker-compose up -d # if you want it to run in the background
Create a Keycloak user (2 min)
To test with the front-end bookmarks.dev create a Keycloak test user. Follow the screenshots in Add a Keycloak user to create it.
Start the development server (API)
nvm use
npm install
npm run debug
This will start the API with nodemon and will watch for code changes and automatically redeploy.
To be able to automatically add youtube videos published date and duration to the title you need to create a nodemon.json file based on the nodemon.json.example and a real youtube api key
Debugging
IntelliJ / Wegstorm (Node.js plugin is required)
The npm run debug
starts nodemon with the --inspect
parameter so you can attach to this process, by using the following configuration:
Visual Studio Code
See Node.js debugging in VS Code with Nodemon
Get Keycloak access token via API call
To get a keycloak access token via API call see Get Access Token from Keycloak via API call
Testing
Integration tests
Start Keycloak and mongodb by issuing the
docker-compose up
command
Run the integration test by issuing the following command.
npm run integration-tests
A report will be generated.
Swagger docs
Deployment
We currently use pm2 to start the project in production.
Start
pm2 start pm2-process.json --env production
Commited is a pm2-process.exammple.json example file
Restart
pm2 restart pm2-process.json --env production
Stop
pm2 stop pm2-process.json --env production
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
License
This project is licensed under the MIT License - see the LICENSE file for details