Lightweight asynchronous http requests scheduler
AsyncReq is a lightweight asynchronous http requests scheduler built on Nodejs and MongoDB.
- Install nodejs
sudo apt install nodejs
- Install npm
sudo apt install npm
- Install mongodb
sudo apt install -y mongodb
- Install the dependencies:
cd ./src && touch .env && npm install
By default, the application will run on port 3000. To set a custom port add the following line to your .env file.
PORT=<YOUR_PORT>
To set the default connection string to a custom mongodb database, add the following line to your .env file.
CONN_STRING=<YOUR_CONNECTION_STRING>
You can also define an authentication token that will be required in all the requests. This will add a permission requirement to the endpoints.
Add the following line to your .env file.
AUTH_TOKEN=<YOUR_AUTHENTICATION_TOKEN>
This endpoint will create a new task.
/api/v1/create (GET)
Parameters:
-
url (required): Full url that will be requested.
-
datetime (required): Moment when url will be requested (format YYYY-mm-dd hh:mm:ss)
-
auth_token (optional): If you have set the AUTH_TOKEN value in your .env file, you must include the value in this parameter.
This endpoint will return the list of tasks in the database.
/api/v1/list (GET)
Parameters:
- auth_token (optional): If you have set the AUTH_TOKEN value in your .env file, you must include the value in this parameter.
This endpoint will delete a task from database by the _id field of the document.
/api/v1/delete/_<_id of task> (GET)
Parameters:
- auth_token (optional): If you have set the AUTH_TOKEN value in your .env file, you must include the value in this parameter.