-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task-server Refactor #37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s a first quick review. I think we can remove a lot from api/store/*
, we don’t need replications and access settings. Probably it would be simpler to just add @hoodie/store-server
as dependency and the require('@hoodie/store-server/api')
and use that internally? Sorry I’m not sure if we discussed that idea yet.
Let me know if you have any question. We can also go trough step by step, get this PR merged first and then build upon it? In that case I would suggest to create a new branch and send the PR against it instead of master
?
@@ -7,8 +7,7 @@ notifications: | |||
email: false | |||
node_js: | |||
- 4 | |||
before_script: | |||
- npm prune |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you leave the npm prune
in? If we don’t have it in store-server, can you send a PR for it? As we cache the node_modules
folder, this can save us lots of headaches
[![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-task-server/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/hoodie-task-server?branch=master) | ||
[![Dependency Status](https://david-dm.org/hoodiehq/hoodie-task-server.svg)](https://david-dm.org/hoodiehq/hoodie-task-server) | ||
[![devDependency Status](https://david-dm.org/hoodiehq/hoodie-task-server/dev-status.svg)](https://david-dm.org/hoodiehq/hoodie-task-server#info=devDependencies) | ||
`hoodie-task-server` is a [Hapi](http://hapijs.com/) plugin that exposes an API for managing tasks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it also exposes routes. Maybe that’s what you mean with API
, but maybe we can clarify this? To me the API is what the plugin exposes at server.plugins.task.api
similar to what store-server and account-server do.
I would mention that hoodie-task-server also defines all necessary CouchDB replication routes so that task objects can be synced, maybe link to somewhere in the CouchDB docs where they are documented?
|
||
```js | ||
var Hapi = require('hapi') | ||
var hapiTask = require('hoodie-task-server') | ||
var hoodietask = require('@hoodie/task-server') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capital "T" => hoodieTask
|
||
```js | ||
options: { | ||
PouchDB: require('pouchdb-core').plugin('pouchdb-adapter-leveldb') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require('pouchdb-core').plugin('pouchdb-adapter-leveldb')
won’t work, this happens to me all the time. What you want is require('pouchdb-core').plugin(require('pouchdb-adapter-leveldb'))
. I think we have to add pouchdb-replication
and pouchdb-mapreduce
to it
```js | ||
options: { | ||
PouchDB: require('pouchdb-core') | ||
.plugin('pouchdb-adapter-http') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above, .plugin
does not accept a string but an object
git clone https://github.com/hoodiehq/hoodie-task-server.git | ||
cd hoodie-task-server | ||
cd hoodie-store-server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
task
|
||
```js | ||
// all methods return promises | ||
task.success(taskDoc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I recall correctly, we wanted to add an additional property where we can pass in properties that get added to the deleted revision, so we can access them and give more context in the client? So it would be task.success(taskDoc, additionalProperties)
, additionalProperties
being optional
@@ -0,0 +1,28 @@ | |||
var Hapi = require('hapi') | |||
var PouchDB = require('pouchdb-core') | |||
.plugin('pouchdb-plugin-http') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.plugin(require('pouchdb-plugin-http'))
also add pouchdb-replication
and pouchdb-mapreduce
@@ -1,45 +1,62 @@ | |||
{ | |||
"name": "@hoodie/task-server", | |||
"description": "CouchDB-based REST & front-end API for asynchronous background tasks", | |||
"description": "Hapi plugin that exposes an API for managing tasks", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exposes routes and an API
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/hoodiehq/hoodie-task-server.git" | ||
"url": "git+https://github.com/hoodiehq/hoodie-task-server.git" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove git+
``` | ||
|
||
## How it works | ||
If you want connect to a CouchDB, use the `pouchdb-adapter-http` and set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If you want connect" should be "If you want to connect"
As discussed here. This is a refactor of the task-server, based on store-server. Further updates are likely necessary, but this should get us going.