Git Product home page Git Product logo

nodejs-rest-queue-server's Introduction

REST Queue Server with a distributed listeners

Build Status npm version

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 dependencies
  • npm start - start server (localhost:8081)
  • npm run tracker waiting - process (waiting tasks) -> complete
  • npm run tracker pending - process (pending tasks) -> complete
  • npm run test - run rest api tests
  • npm run dev - run with nodemon

NPM

Using

  1. Start nodejs server npm start. By defaults it listening on localhost:8081
  2. Create some jobs for further work. Use POST request for http://localhost:8081/jobs {body}
  3. The next step to launch tracker by command npm run tracker waiting or npm run tracker pending depends on what status of the task you want to perform
  4. 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"

nodejs-rest-queue-server's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

theexiled1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.