Bohongan adalah zero-config JSON server untuk mocking REST APIs, dibangun menggunakan Elixir. Terinspirasi dari json-server, Bohongan menyediakan REST API palsu yang bisa langsung digunakan untuk prototyping dan mocking.
- ✨ Tanpa konfigurasi
- 🚀 REST API lengkap berdasarkan struktur data
- 📦 Mendukung GET, POST, PUT, DELETE
- 🔄 Auto-routes untuk semua resources
- 💾 In-memory storage
# Clone repository
git clone https://github.com/raizora/bohongan.git
cd bohongan
# Install dependencies
mix deps.getAda tiga cara untuk menjalankan server:
iex -S mixmix run --no-haltUntuk environment production yang lebih optimal, gunakan release:
# Build release
./scripts/build.sh
# Jalankan server
./scripts/start.sh
# Atau dengan custom port
PORT=3000 ./scripts/start.shServer dapat dikonfigurasi menggunakan environment variables:
# Mengubah port (default: 4000)
PORT=3000 iex -S mixMengambil data dari path tertentu
curl http://localhost:4000/usersMembuat data baru
curl -X POST \
-H "Content-Type: application/json" \
-d '{"name":"John","email":"john@example.com"}' \
http://localhost:4000/usersMengupdate data yang ada
curl -X PUT \
-H "Content-Type: application/json" \
-d '{"name":"John Updated","email":"john@example.com"}' \
http://localhost:4000/users/1Menghapus data
curl -X DELETE http://localhost:4000/users/1# Start server
iex -S mix
# Buat user baru
curl -X POST \
-H "Content-Type: application/json" \
-d '{"name":"Budi","email":"budi@example.com"}' \
http://localhost:4000/users
# Ambil semua users
curl http://localhost:4000/users
# Buat post untuk user
curl -X POST \
-H "Content-Type: application/json" \
-d '{"title":"Post Pertama","content":"Isi post","userId":1}' \
http://localhost:4000/posts
# Ambil semua posts
curl http://localhost:4000/postsKami sangat terbuka untuk kontribusi! Silakan buat issue atau pull request di GitHub.
MIT