Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Todolist

Simple JWT-protected Todo backend built with Node.js, Express, Prisma (PostgreSQL), and bcrypt.

Features

  • Register and login (hashed passwords, JWT auth)
  • Create todos with text and deadline
  • View incomplete and completed lists
  • Mark complete
  • Delete todos

Requirements

  • Node.js >= 18
  • PostgreSQL
  • npm

Setup

  1. Enter server directory and install
cd server
npm install
  1. Create .env
PORT=3000
DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DB_NAME?schema=public"
JWT_SECRET="your-random-secret"
  1. Migrate database and generate Prisma client
npx prisma migrate dev --name init
  1. Run
node index.js
# http://localhost:3000

How to Use

  • Register a user, then log in to get a JWT token.
  • Add the token to requests using: Authorization: Bearer .
  • Use protected routes to create/list/update/delete your todos.

Notes

  • JWT expires in 1 hour by default.
  • Prisma client is generated into src/generated/prisma.

About

Learning by building

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages