A Node.js Express server with a local LLM chat endpoint powered by Ollama.
| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check |
GET |
/users |
Returns a list of users |
POST |
/chat |
Send a prompt to the local LLM |
Request
{ "prompt": "Write a function to reverse a string" }Response
{
"model": "qwen2.5-coder:7b",
"response": "..."
}Prerequisites: Node.js 18+, Ollama installed and running.
# Install dependencies
npm install
# Pull the model
ollama pull qwen2.5-coder:7b
# Start the server
npm startServer runs on http://localhost:3000 by default.
| Env var | Default | Description |
|---|---|---|
PORT |
3000 |
Server port |
OLLAMA_URL |
http://localhost:11434 |
Ollama base URL |
OLLAMA_MODEL |
qwen2.5-coder:7b |
Model to use |
npm testTests use Jest + supertest. The Ollama API is mocked so tests run without a live model.