Closed djensen47 closed 8 years ago
It looks like the examples in the docs directory were not updated to use a require statement instead of a string. I can submit a pull request to fix this tomorrow-ish.
That would be awesome. If you need any help, please ping me. I might be able to assist you.
Also, the getting started guide for Seneca is maybe using an old example of how to integrate seneca with a web server: http://senecajs.org/getting-started/#web-server-integration
There is no reference to seneca-web in this section and I think the example only works on Express? Maybe that's an issue for the seneca repo but I thought I might mention it here too.
Hi djensen47 ,
Yes, the example is no longer synchronized with current state of plugins. I ran into the same problem with the express example. The issue is that the adapter can no longer be called as stated in the code. You must require a special plugin for Express located here : https://github.com/senecajs/seneca-web-adapter-express
Now after moving some files for my personal arrangement, I was able to make it run :
'use strict'
var Seneca = require('seneca')
var Express = require('express')
var Web = require('seneca-web')
var Routes = require('./routes')
var Plugin = require('./plugin')
var config = {
routes: Routes,
adapter: require('seneca-web-adapter-express'),
context: Express()
}
var seneca = Seneca() .use(Plugin) .use(Web, config)
.ready(() => {
var server = seneca.export('web/context')()
server.listen('4000', () => {
console.log('server started on: 4000')
})
})
The point is to require 'seneca-web-adapter-express' and pass it as the adapter. The same seems to go for hapi, have a look at https://github.com/senecajs/seneca-web-adapter-hapi
Hope this can help.
Yup, thanks, helpful. I discovered this the other day too.
Hi Dave,
What do you get exactly and how do you send your request ?
Ivan Matmati
----- Mail original -----
De: "Dave Jensen" notifications@github.com À: "senecajs/seneca-web" seneca-web@noreply.github.com Cc: "ivan matmati" ivan.matmati@laposte.net, "Comment" comment@noreply.github.com Envoyé: Mercredi 2 Novembre 2016 01:16:05 Objet: Re: [senecajs/seneca-web] Quick example does not work (#107)
Also, it appears that the Express example doesn't work at all even when using require for the adapter.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub , or mute the thread .
I didn't understand the question but I went ahead and fixed the examples with #112.
Good, I was thinking about those changes, but you did it. Now, all examples will be ... working examples.
I cloned the repository. Did an
npm install
. Went into the examples directory. Rannode using-hapi.js
and received the following error: