REST API for a bookmarking application (just like chrome bookmarks) using Node/Express and MongoDB
A bookmarking-service built using ExpressJS, MongoDB.
- Fork this repository
- "Forking" adds a copy of adisakshya/bookmarking-service repository to your GitHub account as
https://github.com/YourGitHubUserName/bookmarking-service
- "Forking" adds a copy of adisakshya/bookmarking-service repository to your GitHub account as
- Or you can download or clone this repository
- You can clone the repository executing below command in a location of your choice of your system.
$ git clone https://github.com/adisakshya/bookmarking-service.git
- You can clone the repository executing below command in a location of your choice of your system.
- That's it your almost done, now in the repository root, run the following command
$ cd src/
, this will take you to main source code directory.
- Make sure you have (not necessary)
- Docker installed
- Make sure you have docker installed before proceeding.
- In source directory
src/
, run the following commanddocker-compose up --build -d
- Running docker-compose in detached mode
- In source directory
- As soon as the build completes you are all set to get started with bookmarking-service.
- Now you have successfully setup bookmarking-service,
- Please find the api-documentation for application server here.
- It describe all routes that define the operation the application server.
- Make sure you have running MongoDB database and connection string as well.
- In database config file
src/bookmark/config/config.json
, replace the connection string with yours - That's it! Now from directory
src/bookmark/
, the following commandnpm start
, to start the bookmarking service
npm test
, to run tests on the bookmarking service
- In database config file
- Now you have successfully setup bookmarking-service without docker,
- Please find the api-documentation for application server here.
- It describe all routes that define the operation the application server.
- In directory
src/bookmark/
, there are two Dockerfiles -prod.Dockerfile & test.Dockerfile
- They are added to aid in the testing process during Continuous Integration (CI) Builds.
- The
prod.Dockerfile
is for production image, andtest.Dockerfile
for test image. - You'll have a container with the production code, as well as the required environment.
- You can now add tests and development libraries and run these tests in the same environment production environment with the same code and the same version of libraries and frameworks.
- This is a great advantage of this method, because testing in a build machine (like Jenkins) may lead to unexpected surprises in production, caused by changes in the environment.
- Operate from directory
src/bookmark/
- Build the production docker image using following command
docker build -t adisakshya/bookmark-service:tag -f prod.Dockerfile
- Now build and run the test docker image using following command
docker build -t adisakshya/bookmark-service-test:tag -f test.Dockerfile --build-arg PRODUCTION_IMAGE_TAG=tag
docker run adisakshya/bookmark-service-test:tag
- Operate from directory
src/bookmark/
- Make sure you have running MongoDB database and connection string as well.
- In database config file
src/bookmark/config/config.json
, replace the connection string with yours
- In database config file
- Now run the tests using following command
npm test
When tests complete, junit reports are generated that describe the passing and failing test cases. The can be found at src/bookmarks/build/reports
. I have added a sample report from tests that I ran.
Is a feature you care about currently missing? Make sure to browse the issue tracker and add your ":+1:" reaction to the issues you care most about, as we also use those reactions to prioritize issues.
There are multiple ways to contribute to this project, read about them here.
🌟 Star this repo if bookmarking-service helped you.
All versions of the app are open-sourced, read more about this LICENSE.