julipinto / To-Do_AppsScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

To-Do

tiny project to make an To Do rest API using Google Spreadsheet and Apps Script

Database

For the Schema of the spreadsheet, we have the main page named Tasks, and the data with the columns:

id task status

as we can see in the image

Router

Apps script just provide two main routes to be accessed, doGet and doPost. Consequently, I have a hard coded router (Node.js axios inspired) to increase the quantity of routes we can access. with that setted, the routes are accessed by passed by the param "q"

Routes

POST {baseurl}?q=insertTask

body = {
  task: 'TASK DESCRIPTION',
  status: 'PENDING' | 'DONE' | 'ANOTHER',
};

POST {baseurl}?q=getTask

// The task can be filtered by the status
body = {
  filter: 'PENDING' | 'DONE' | 'ANOTHER',
};

POST {baseurl}?q=modfyTask

// You have to provide either task, status, or both to be edited. The id is mandatory.
body = {
  id: 'TASK ID',
  task: 'TASK DESCRIPTION',
  status: 'PENDING' | 'DONE' | 'ANOTHER',
};

About


Languages

Language:JavaScript 100.0%