@sebastián-cisneros In static:api.routes, you'll want to call controllerHelpers.setupAPIRoute to mount the route to the appropriate /api/v3/plugins mount point.
You can see an example of how we do it in the quickstart plugin
Hello,
I am trying to make an integration between a laravel app and nodebb and i found this plugin that would allow me to interact via cURL.
However, i tried installing it several times, it is not working. At least the route for the admin view.
This is the error i get when i navigate to admin/plugins/write-api:
Also, in the plugin package.json:
"nbbpm": {
"compatibility": "^0.8.3"
}
And i have the latest version installed, 0.8.2
Thanks in advance
Did you activate it? After activating it, did you restart NodeBB?
Yes @pitaj , and i repeated the process several times. Every other plugin works for me except this one
@Coman-Cosmin Are there any errors in the console when you run ./nodebb dev
?
@pitaj Yes, please find the error below:
18/10 15:57 [2727] - error: Error: listen EADDRINUSE
at errnoException (net.js:905:11)
at Server._listen2 (net.js:1043:14)
at listen (net.js:1065:10)
at Server.listen (net.js:1139:5)
at listen (/root/mynodebb/src/webserver.js:180:17)
at /root/mynodebb/src/webserver.js:57:3
at EventEmitter.<anonymous> (/root/mynodebb/src/emitter.js:17:5)
at EventEmitter.emit (events.js:92:17)
at /root/mynodebb/src/meta/css.js14
at /root/mynodebb/node_modules/async/lib/async.js:697:13
18/10 15:57 [2727] - error: NodeBB address in use, exiting...
[cluster] Child Process (2727) has exited (code: 0, signal: null)
Sorry, i did not stop nodebb first. Here is the actual error:
8/10 16:00 [2755] - error: [plugins] Error executing 'static:app.load' in plugin 'nodebb-plugin-write-api'
18/10 16:00 [2755] - error: Error: Cannot find module './src/postTools'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at Object.<anonymous> (/root/mynodebb/node_modules/nodebb-plugin-write-api/routes/v1/posts.js:4:30)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
And when i navigate to the route i get:
18/10 16:02 [2755] - warn: Route requested but not found: /api/admin/plugins/write-api?_=1445198550174
@Coman-Cosmin What git hash are you on?
Try running git rev-parse HEAD
in the nodebb
directory
@Coman-Cosmin Okay, your problem is that you are on the master branch, which is v0.9.x-dev
. To switch, shut down NodeBB and run git checkout v0.8.x
. This may make your database unusable, although most of the data should be available still, so back it up before doing this.
Then run npm install
and you should be good.
@pitaj said:
npm install
It works now. Thanks a lot for your help. Would have never figured out by myself:)
Awesome idea with this API btw, i almost gave up because i'm not familiar with nodejs, but when i found this plugin i realised that this is no longer an issue:)
Great work guys