Skip to content

ProRocketeers/db-connections-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple TODO API with Bun, Elysia, PostgreSQL, and Redis

Setup

  1. Install dependencies:
bun install
  1. Copy environment file:
cp .env.example .env
  1. Edit .env with your PostgreSQL and Redis credentials

  2. Run the server:

bun run start

API Endpoints

PostgreSQL

  • GET /swagger - Interactive API documentation
  • GET /todos - List all todos
  • POST /todos - Create todo: {"title": "Buy milk", "completed": false}
  • PUT /todos/:id - Update todo: {"title": "Buy milk", "completed": true}
  • DELETE /todos/:id - Delete todo

Redis

  • GET /redis/test - Test Redis connection
  • GET /redis/:key - Get value by key
  • POST /redis - Set key-value: {"key":"mykey","value":"myvalue","ttl":60} (ttl optional)
  • DELETE /redis/:key - Delete key

Test

curl http://localhost:3000/todos
curl -X POST http://localhost:3000/todos -H "Content-Type: application/json" -d '{"title":"Test todo"}'

Docker

Build and run:

docker build -t todo-api .
docker run -p 3000:3000 --env-file .env todo-api

About

A repository, used to test rock8.cloud database deploy and enviroment configuration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors