Skip to content

luismontanaresm/AsyncReq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AsyncReq

Lightweight asynchronous http requests scheduler

AsyncReq is a lightweight asynchronous http requests scheduler built on Nodejs and MongoDB.

Installation

  1. Install nodejs

sudo apt install nodejs

  1. Install npm

sudo apt install npm

  1. Install mongodb

sudo apt install -y mongodb

  1. Install the dependencies:

cd ./src && touch .env && npm install

Configuration

Port

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>

Database connection

To set the default connection string to a custom mongodb database, add the following line to your .env file.

CONN_STRING=<YOUR_CONNECTION_STRING>

Authentication token

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>

Endpoints:

1. Create

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.

2. List

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.

3. Delete

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.

About

Lightweight asynchronous http requests scheduler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published