Skip to content

cremalab/todo-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

todo-api

This API is meant as a basic API to learn how to implement REST CRUD actions into a front-end application.

It has basic CRUD actions for a task:

  • Create a task with POST /tasks
  • Read a task with GET /tasks or GET /tasks/:id
  • Update a task with PATCH /tasks/:id
  • Delete a task with DELETE /tasks/:id

Tools Used

  • Node - The JavaScript runtime used to run the backend
  • TypeScript - Language used to add static types on top of JavaScript
  • Express - A framework used to build an API with Node
  • Prisma - Used as the ORM for defining and accessing the Database
  • SQLite - A small, fast, and portable SQL based Database

Setup Instructions

  1. Run nvm use to use the supported version of node
  2. Run npm i to install the dependencies
  3. Create a .env file located at ./prisma/.env with the contents DATABASE_URL="file:./dev.db"
  4. Run npm run prisma:migrate to setup (or reset) the database
  5. Run npm start to start the API
  6. Run npm run prisma:studio to open the Prisma Studio UI

How to Use

  • Follow the Setup Instructions to get the API and Prisma Studio running locally
  • If desired, manually add data to the Database by using Prisma Studio
  • Once the API is running it can be accessed at http://localhost:3001
  • If you need to reset the Database you can use the script npm run prisma:migrate
  • A list of routes is located at docs/routes.md
  • A description of the different entities is located at docs/entities.md

Important Files

  • ./src/index.ts - This file is where the Express server is located and where the routes are defined
  • ./prisma/schema.prisma - This is where the Database schema is defined
  • ./prisma/dev.db - This file is the actual SQLite database, it can be deleted to reset the DB

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors