nodejs-rest-queue-server
v1.1.4
Published
Nodejs Rest Queue Server
Downloads
2
Maintainers
Readme
REST Queue Server with a distributed listeners
Requirements
- NodeJS >=8.x & NPM 5.x
- Postgres 9.x
Implemented
- KOA2 middleware
- Postgres Listen/Notify
- Sockets
- Native Promise queuing
- ES2017 async/await
Configuration
- .env
Installation
npm i
- install dependenciesnpm start
- start server (localhost:8081)npm run tracker waiting
- process (waiting tasks) -> completenpm run tracker pending
- process (pending tasks) -> completenpm run test
- run rest api testsnpm run dev
- run with nodemon
Using
- Start nodejs server
npm start
. By defaults it listening on localhost:8081 - Create some jobs for further work. Use POST request for
http://localhost:8081/jobs {body}
- The next step to launch tracker by command
npm run tracker waiting
ornpm run tracker pending
depends on what status of the task you want to perform - The tracker will process the tasks while they exist, then every second it will ask the server to process for new tasks in the order of the queue FIFO one by one and in real time to notify the client of the fulfillment
Conclusion
- Documentation: /docs
- Client: /public/index.html
curl -XPOST "localhost:8081/jobs" -d '{"title":"Test title","description":"Test Description","type":"feature", "status" : "waiting"}' -H 'Content-Type: application/json'
curl -XGET "localhost:8081/jobs"
curl -XGET "localhost:8081/jobs/status/:waiting/limit/:1"
curl -XPUT "localhost:8081/jobs/1" -d '{"title":"Test1", "type" : "hotfix", "status" : "waiting"}' -H 'Content-Type: application/json'
curl -XGET "localhost:8081/jobs/1"
curl -XDELETE "localhost:8081/jobs/1"