This repo contains a ModelSEED RESTful API. The API wraps the ProbModelSEED and Workspace Services and provides additional methods used in the ModelSEED web app.
node
git clone https://github.com/nconrad/ModelSEED-REST.git
cd ModelSEED-REST
npm install --production
Note: npm install
installs all node module dependencies
But: npm install --production
will only install node dependencies required for the server to run
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
API tests are ran with npm test
or gulp test
.
npm 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. See ModelSEED-UI
for the front-end code.
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 forever.pid -a server.js
In addition to starting the dev server instance as mentioned above in ## Start Dev Server
, in order for the nodemailer's transporter.sendMail() to succeed, a local Postfix mail system needs to be started by running:
sudo postfix start
###If Postfix is already running, you will get 'postfix/postfix-script: fatal: the Postfix mail system is already running' error.
Then you can test if the Postfix mail system is running with these commands:
echo hello | sendmail user@domain
mailq
The mailq
command will show the mail queue content.
When modelseed-ui is running in localhost:8089 and a user comment is sent, the server.js screen will have something like the following:
POST /v0/comments
request string:
{"comment":{"user":{"username":"qzhang"},"rowId":"cpd00002","comments":["bad formula","bad structure"]}}
comment data:
{ user: { username: 'qzhang' },
rowId: 'cpd00002',
comments: [ 'bad formula', 'bad structure' ] }
mail content:
{ from: 'help@modelseed.org',
to: 'qzhang@anl.gov',
subject: 'MODELSEED-113',
text: '',
html: 'Message: [\n "bad formula",\n "bad structure"\n]<br><br>Id: cpd00002<br><br>User: <br><pre>{\n "username": "qzhang"\n}</pre><br><br>' }
Comments sent: 250 2.0.0 Ok: queued as 73752191F0A2
And in my email inbox I'd have received the above mail content
.
If the email recipient is help@modelseed.org
, then anyone on the list will receive the email AND the Jira ticket at
https://jira.cels.anl.gov/browse/MODELSEED-113
will record the email content as a comment.
- 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.