Spaces:
Sleeping
Sleeping
File size: 3,559 Bytes
ffa0093 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | # DocVault Quick Start Guide
Get up and running with DocVault in 5 minutes!
## Step 1: Install Dependencies
```bash
cd server
pip install -r requirements.txt
```
## Step 2: Start the Server
```bash
python app.py
```
You should see:
```
Starting DocVault on http://localhost:5000 (DEBUG: True)
```
## Step 3: Test the API
Open a new terminal and run these curl commands:
### Create a folder
```bash
curl -X POST http://localhost:5000/api/create-folder \
-H "Content-Type: application/json" \
-H "X-User-ID: test_user" \
-d '{"folder_path": "MyDocuments"}'
```
### Upload a file
```bash
curl -X POST http://localhost:5000/api/upload-file \
-H "X-User-ID: test_user" \
-F "folder_path=MyDocuments" \
-F "file=@tests/test_file.txt"
```
### List contents
```bash
curl -X GET http://localhost:5000/api/list \
-H "X-User-ID: test_user"
```
### Check storage stats
```bash
curl -X GET http://localhost:5000/api/storage-stats \
-H "X-User-ID: test_user"
```
## Step 4: Using Python Requests
```python
import requests
import json
BASE_URL = "http://localhost:5000/api"
HEADERS = {"X-User-ID": "test_user"}
# Create folder
response = requests.post(
f"{BASE_URL}/create-folder",
json={"folder_path": "Projects"},
headers=HEADERS
)
print(response.json())
# Upload file
with open("tests/test_document.md", "rb") as f:
files = {"file": f}
data = {"folder_path": "Projects"}
response = requests.post(
f"{BASE_URL}/upload-file",
files=files,
data=data,
headers=HEADERS
)
print(response.json())
# List contents
response = requests.get(
f"{BASE_URL}/list?folder_path=Projects",
headers=HEADERS
)
print(json.dumps(response.json(), indent=2))
# Storage stats
response = requests.get(
f"{BASE_URL}/storage-stats",
headers=HEADERS
)
print(response.json())
```
## Step 5: Using Postman
1. Import `tests/DocVault.postman_collection.json` into Postman
2. Set the `X-User-ID` header for each request
3. Test all endpoints
## File Structure
After running some operations, your file structure will look like:
```
data/
βββ test_user/
βββ MyDocuments/
β βββ test_file.txt
β βββ .gitkeep
βββ Projects/
β βββ test_document.md
β βββ .gitkeep
βββ .gitkeep
```
## Directory Size
Check storage usage:
```bash
# Windows
dir /s /b data\
# Linux/Mac
du -sh data/
```
## Troubleshooting
### Port 5000 Already in Use
```bash
# Find process using port 5000
netstat -ano | findstr :5000 # Windows
lsof -i :5000 # Mac/Linux
# Kill process
taskkill /PID <PID> /F # Windows
kill -9 <PID> # Mac/Linux
# Or use different port (modify app.py)
```
### Module Import Errors
Ensure you're in the correct directory:
```bash
cd /path/to/DocVault
python server/app.py
```
### Permission Denied
Ensure write permissions:
```bash
chmod 755 data logs # Mac/Linux
# Windows should work automatically
```
## Next Steps
1. **Explore the API** - Try all endpoints with different user IDs
2. **Test with files** - Upload various file types
3. **Integrate** - Embed DocVault into your application
4. **Scale** - Plan for database backend or cloud storage
## API Reference
See [README.md](../README.md) for complete API documentation.
## Support
For issues:
1. Check logs in `logs/` directory
2. Review error messages in response
3. Verify file/folder names are valid
4. Ensure user ID is consistent across requests
---
**Happy documenting with DocVault!** πβ¨
|