A webhooks microservice API using Molecular and Node.js containing CRUD operations for working with URLs and a Trigger operation to send POST requests to the URLs from the databases in batches.
This is a Moleculer-based microservices project. Generated with the Moleculer CLI.
- Molecular To create a microservice
- Node.js To create a gateway API for the microservices
- MongoDB Database to store the URLs
- NATS server Message broker for running the microservices
Start the project with npm run dev
command.
After starting, open the http://localhost:3000/ URL in your browser.
On the welcome page you can test the webhooks services via API Gateway and check the nodes & services.
In the terminal, try the following commands:
nodes
- List all connected nodes.actions
- List all registered service actions.call webhooks.list
- Call thewebhooks.list
action. This displays all the webhooks in the databasecall webhooks.register --targetUrl www.mywebsite.com
- Call thewebhooks.register
action with thetargetUrl
parameter.- ...And so on
- api: API Gateway services
- webhooks: Webhooks microservice. To use with MongoDB, set
MONGO_URI
environment variables and install MongoDB adapter withnpm i moleculer-db-adapter-mongo
.
- db.mixin: Database access mixin for services. Based on moleculer-db
- Moleculer website: https://moleculer.services/
- Moleculer Documentation: https://moleculer.services/docs/0.14/
- NATS Documentation: https://docs.nats.io/
- Docker Documentation: https://docs.docker.com/
npm run dev
: Start development mode (load all services locally with hot-reload & REPL)npm run start
: Start production mode (setSERVICES
env variable to load certain services)npm run cli
: Start a CLI and connect to production. Don't forget to set production namespace with--ns
argument in scriptnpm run ci
: Run continuous test mode with watchingnpm test
: Run tests & generate coverage reportnpm run dc:up
: Start the stack with Docker Composenpm run dc:down
: Stop the stack with Docker Compose