Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 180a5e4

Browse files
committedFeb 23, 2016
Merge pull request #69 from ipfs/feature/http-api
WIP: Make http-api endpoints as specified by the http-api-spec, for the features present in core
2 parents 50d95a7 + d169279 commit 180a5e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+824
-436
lines changed
 

‎package.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
"main": "src/index.js",
99
"scripts": {
1010
"lint": "standard",
11-
"coverage": "istanbul cover --print both -- _mocha tests/test-*/index.js",
11+
"coverage": "istanbul cover --print both -- _mocha tests/test-core/index.js",
1212
"test": "npm run test:node && npm run test:browser",
13-
"test:node": "mocha tests/test-*/index.js",
13+
"test:node": "npm run test:node:core && npm run test:node:http-api && npm run test:node:cli",
14+
"test:node:cli": "mocha tests/test-cli/index.js",
15+
"test:node:core": "mocha tests/test-core/index.js",
16+
"test:node:http-api": "mocha tests/test-http-api/index.js",
1417
"test:browser": "karma start karma.conf.js",
1518
"test:core": "mocha tests/test-core/index.js",
16-
"test:cli": "mocha tests/test-cli/index.js",
17-
"test:cli-offline": "mocha tests/test-cli-offline/index.js"
19+
"test:cli": "mocha tests/test-cli/index.js"
1820
},
1921
"pre-commit": [
2022
"lint",
@@ -67,9 +69,11 @@
6769
"bs58": "^3.0.0",
6870
"debug": "^2.2.0",
6971
"hapi": "^12.0.0",
72+
"ipfs-api": "^2.13.1",
7073
"ipfs-blocks": "^0.1.0",
7174
"ipfs-merkle-dag": "^0.2.1",
7275
"ipfs-repo": "^0.5.0",
76+
"joi": "^8.0.2",
7377
"lodash.get": "^4.0.0",
7478
"lodash.set": "^4.0.0",
7579
"peer-id": "^0.5.0",

‎src/cli/commands/daemon.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,28 @@ const Command = require('ronin').Command
44
const httpAPI = require('../../http-api')
55
const debug = require('debug')
66
const log = debug('cli:daemon')
7-
log.error = debug('cli:damon:error')
7+
log.error = debug('cli:daemon:error')
88

99
module.exports = Command.extend({
1010
desc: 'Start a long-running daemon process',
1111

1212
run: name => {
13+
console.log('Initializing daemon...')
1314
httpAPI.start((err) => {
14-
if (err) { return log.error(err) }
15-
log('daemon started')
15+
if (err) {
16+
return log.error(err)
17+
}
18+
console.log('Daemon is ready')
19+
})
20+
21+
process.on('SIGINT', () => {
22+
console.log('Received interrupt signal, shutting down..')
23+
httpAPI.stop((err) => {
24+
if (err) {
25+
return log.error(err)
26+
}
27+
process.exit(0)
28+
})
1629
})
1730
}
1831
})

0 commit comments

Comments
 (0)
This repository has been archived.