Giter Club home page Giter Club logo

todo-app's Introduction

Frontend repository can be found here.

PSQL was used to create the database.

  • The configuration can be found here.
  • The SQL dump file can be found here. Please copy this to your PSQL bin folder.

Steps to create the database in PSQL using the dump file:

  1. Run SQL shell (psql) and create the database tasks. (If you would like to rename it something else, make sure to change the database specified in the db.js config.)
  2. Run cmd on adminstrator.
  3. cd to your PSQL bin folder. The file path should look something like this: C:\Program Files\PostgreSQL\14\bin.
  4. Restore the dump file in the database you created in step 1 by running the following command in cmd:
psql DATABASE_NAME_HERE < todo.sql

Optional: Use the flag -U postgres if you are having issues with password authentication.

image

If you encounter trouble using the dump file, here are the manual commands to run in SQL shell (psql):

CREATE TABLE tasks (
  id SERIAL PRIMARY KEY,
  description VARCHAR (100) UNIQUE NOT NULL
);

CREATE TYPE status AS ENUM ('in-progress', 'completed');
ALTER TABLE tasks
ADD COLUMN status status;

CREATE TYPE priority AS ENUM ('low', 'medium', 'high');
ALTER TABLE tasks
ADD COLUMN priority priority;

Make sure you have the latest version of Express and Node installed.

npm install
After connecting to the PSQL server, use npm run dev to run the API.

image
image

If I'd had more time, I would've also created Sequelize models and a seed script.

Getting a single to-do
  • User is able to make a GET request for a task specified by its ID, using getTaskById.
  • Endpoint: /tasks/:id

Getting multiple to-do's
  • User is able to make a GET request for all tasks found in the database, using getTasks.
  • Endpoint: /tasks
  • User is able to make a GET request for filtered tasks by completion status (i.e., in-progress or completed) using getTasksByStatus, or by priority level (i.e., low, medium, or high) using getTasksByPriority.
  • Endpoint: /tasks/status/:status
  • Endpoint: /tasks/priority/:priority

Adding a single to-do
  • User is able to make a POST request for a task using addTask.
  • Endpoint: /tasks

Editing a single to-do
  • User is able to make a PUT request for a task specified by its ID, using updateDescription, updateStatus, and/or updatePriority.
  • Endpoint: /update/description/:id
  • Endpoint: /update/priority/:id
  • Endpoint: /update/status/:id

Deleting a to-do
  • User is able to make a DELETE request for a task specified by its ID, using deleteTask.
  • Endpoint: /tasks/:id

todo-app's People

Contributors

lucylee-412 avatar

Watchers

 avatar

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.