Skip to content
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

Use as server module with nedb #5

Open
sajov opened this issue Mar 31, 2018 · 1 comment
Open

Use as server module with nedb #5

sajov opened this issue Mar 31, 2018 · 1 comment

Comments

@sajov
Copy link

sajov commented Mar 31, 2018

Hi,
i like to use it as a server side module but it does not use nedb. It seem i miss something

const mysam = require('mysam-core')();
const createService = require('feathers-nedb');
const createModel = require('./models/mysam.model');
const Model = createModel(app);
const paginate = app.get('paginate');
const options = {
    name: 'mysam',
    Model,
    paginate
  };
mysam.init(createService(options)); // is not working|writing to nedb

app.use('/trainings', mysam.service('trainings'));
app.service('trainings').create({text:'hallo'}).then(res => {console.log(res)}).catch(err => {console.log(err)})`

It still use the module service.
Any suggestions? thx

@daffl
Copy link
Member

daffl commented Apr 3, 2018

I just realized that what I did there (https://github.com/mysamai/mysam-core/blob/master/lib/app.js#L16) actually wasn't that great but I think the following should work:

const mysam = require('mysam-core')();
const createService = require('feathers-nedb');
const createModel = require('./models/mysam.model');
const Model = createModel(app);
const paginate = app.get('paginate');
const options = {
    name: 'mysam',
    Model,
    paginate
  };

mysam.init(() => createService(options));

app.use('/trainings', mysam.service('trainings'));
app.service('trainings').create({text:'hallo'}).then(res => {console.log(res)}).catch(err => {console.log(err)})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants