npm install -g jscpd-server
jscpd-server
The server starts on http://localhost:3000 by default.
POST /api/check
curl -X POST http://localhost:3000/api/check \
-H "Content-Type: application/json" \
-d '{
"code": "console.log(\"hello\");\nconsole.log(\"world\");",
"format": "javascript"
}'
{
"clones": [],
"statistics": {
"lines": 2,
"tokens": 10,
"duplicatedLines": 0,
"percentage": 0
}
}
# Custom port
jscpd-server --port 8080
# Custom options
jscpd-server --min-lines 3 --min-tokens 30