1
0
Files
OpenWall/server
..
2025-07-18 11:49:16 +02:00
2025-07-18 14:36:45 +02:00
2025-07-18 19:30:16 +02:00
2025-07-18 11:49:16 +02:00
2025-07-18 19:30:16 +02:00
2025-07-18 10:48:00 +02:00
2025-07-18 10:48:00 +02:00

Shopping List Server

A simple Express.js server with SQLite database for managing shopping list items.

Features

  • CRUD operations for shopping list items
  • Automatic cleanup of checked items after 2 hours
  • SQLite database with Sequelize ORM
  • CORS enabled for frontend integration
  • RESTful API endpoints

Database Schema

Each shopping item has:

  • id: Unique identifier (auto-increment)
  • name: Item name (required)
  • amount: Quantity/amount (default: "1")
  • checked: Boolean status (default: false)
  • checkedAt: Timestamp when item was checked
  • date: Creation date
  • createdAt: Auto-generated creation timestamp
  • updatedAt: Auto-generated update timestamp

API Endpoints

Shopping Items

  • GET /api/shopping - Get all shopping items
  • GET /api/shopping/:id - Get a specific shopping item
  • POST /api/shopping - Create a new shopping item
  • PUT /api/shopping/:id - Update a shopping item
  • PATCH /api/shopping/:id/toggle - Toggle checked status
  • DELETE /api/shopping/:id - Delete a shopping item
  • DELETE /api/shopping/checked/all - Delete all checked items

Health Check

  • GET /api/health - Server health check

Installation

  1. Install dependencies:

    pnpm install
    
  2. Start the development server:

    pnpm dev
    
  3. Or start the production server:

    pnpm start
    

The server will run on http://localhost:3001 by default.

Environment Variables

  • PORT: Server port (default: 3001)
  • NODE_ENV: Environment mode (development/production)

Auto-cleanup

Checked items are automatically deleted after 2 hours. The cleanup runs every 30 minutes.