Sign inSign up

gasse038/hw1_api

By gasse038

•Updated over 4 years ago

toDo is an API that tracks a simple To Do list! Contains: README, Dockerfile, toDo.js (main driver)

Image
0

196

gasse038/hw1_api repository overview

⁠Tiny To Do List! (based in NodeJS)

This simple API tracks a user-created To Do List! It is able to add tasks, complete tasks, return a list of complete tasks, return the list of all tasks added to the list, and clear the to do list (but not the completed task list)!

⁠Pre-requisites

  • Node JS⁠

  • Install express and requests:

    npm install express --save
    npm install request --save
    

⁠Pulling the toDo API via Docker

docker pull gasse038/hw1_api

⁠Running the web server

Navigate to the folder in which you pulled the repository into using the cd command. From the command line start the server with the following command:

docker run gasse038/hw1_api

⁠Using the To Do List!

Now that the server is running... Use Postman, CURL, or other program to call the following functions:

For Postman Users: Create a new GET or POST call in Postman. For POST-- In both the 'Param' and 'Body' (in JSON view) sections of the POST function call, specify the parameters and values that you wish to pass into the To Do List. The links below are to the functions, and below each link is a description of the function and what parameters it takes.

Parameters: None. This function returns the current, full To Do List, including tasks that may have already been labeled as 'completed'. Each task will have a task name, a user-passed due date, and the time that the task was added to the To Do List. Note that the Full To Do List may contain tasks that the user has 'completed', as the completeTask function does not remove those tasks from the Full To Do List.

Paramters: None This function returns a list of all of the tasks that have been completed by the user. Each task will be preceded by a message that indicates that it has been completed, as well as the time it was completed.

Parameters: None This function clears the 'tasklist' (Full To Do List) but does NOT clear the To Do List history. The history list will still contain tasks that the user has 'completed'.

Parameters:

{ "task" : [ user task for list ] (of type 'string' )   }

The user passes in the name of the task that they wish to complete from the list. This function adds the specified task to the history list, changing the task name to "COMPLETE: [ task ]". The time the task was completed is also added. This function does NOT remove the corresponding task from the Full To Do List. This is to allow users that want to track progress on a project with multiple tasks to add the tasks they have already completed for the project to the history list without the need to add each individual task to the To Do List before completion.

POST /toDo/addTask: Parameters:

 {    "task" : [ user task for list ] (of type 'string' ),
       "dueDate" : [ user-defined due Date (of type 'string'; 
                            default: "NO SPECIFIED DUE DATE")]     }

This function adds a task to the Full To Do List. It takes in the task 'name' (which is the specific task that the user wants to add to the list) and a due date, if there is one. If no due date is specified, the program adds the task to the list with a default due date of "NO SPECIFIED DUE DATE". Each task on the task list also contains what time the task was added to the To Do List.

⁠Running via Docker

  1. Build the image:
```bash
docker build -t my-toDoList .
```

2. Run the image:

```bash
docker run -p 127.0.0.1:8087:8087 -it my-toDoList
```

Tag summary

Content type

Image

Digest

Size

336 MB

Last updated

over 4 years ago

docker pull gasse038/hw1_api