This repo contains a REST-like API for accessing a user's FTP space.
node
git clone https://github.com/kbase/kb-ftp-api.git
cd kb-ftp-api
npm install
node server.js --dev
To make our lives easier, running gulp
starts a development server along with a process to
update ./api-documentation.json. The dev server will restart automatically on file change (any .js file).
For testing, a token can be placed in the file ./dev-user-token
.
gulp
Running tests requires a little local setup. You'll need to do the following:
-
Set the test environment. In
config/env.json
, set the deployment to "test". In the config directory, you can also modifyconfig-test.json
to your liking. Mainly, you'll need to set the "ftpRoot" key to a local directory of your choosing, that will be modified by the tests. -
Make a local file storage directory. As mentioned above, you need a local directory to act as a dummy FTP root. Create that and set it in
config/config-test.json
-
Set the test configuration. Running tests requires a file called
tests/test-cfg.json
. This is a JSON file with the following structure:
{
"authToken": Valid authentication token string,
"userId": The user id linked to that token
}
- Start a server.
node server.js
- Run the tests.
API tests are run with
npm test
orgulp test
.
Docstrings in server.js are parsed into JSON using ./docs/parse-docs.js
.
The resulting JSON structure ./api-documentation.json
is then used to produce
fancy online documentation.
Note: api-documentation.json
is automatically rebuilt with gulp.
To manually build it, run:
gulp docs
The server script server.js
should be ran with forever.
forever start -l /logs/server.log --pidFile /tmp/a -a server.js
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
Neal Conrad nconrad@anl.gov
Released under the MIT license.