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 checkeddate
: Creation datecreatedAt
: Auto-generated creation timestampupdatedAt
: Auto-generated update timestamp
API Endpoints
Shopping Items
GET /api/shopping
- Get all shopping itemsGET /api/shopping/:id
- Get a specific shopping itemPOST /api/shopping
- Create a new shopping itemPUT /api/shopping/:id
- Update a shopping itemPATCH /api/shopping/:id/toggle
- Toggle checked statusDELETE /api/shopping/:id
- Delete a shopping itemDELETE /api/shopping/checked/all
- Delete all checked items
Health Check
GET /api/health
- Server health check
Installation
-
Install dependencies:
pnpm install
-
Start the development server:
pnpm dev
-
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.