These are chat archives for quorrajs/quorrajs

6th
Jul 2016
maq
@maqboolkhan
Jul 06 2016 04:38

@harishanchu is this correct syntax for App.url.route with parameters

app.url.route('user', 1)

Harish
@harishanchu
Jul 06 2016 09:42

All the following will work:

App.url.to('user', {someQueryParam: 'hii', id: 89024});

App.url.to('user', [89024, 'hii']);

App.url.to('user', 89024);

You can pass parameters as array, object or as string/integer(if there is only one prameter).

If you are passing parameters as object, url generator will try to replace your named route parameters from object attributes.

URL generator had some bugs which I have fixed in latest version .
Please use latest version of Quorra before trying all these.
Note: Latest version of Quorra cli supports console command as well as file watch option for ride command
maq
@maqboolkhan
Jul 06 2016 10:46
yes u r right
using as object is quite buggy
ok m on it
maq
@maqboolkhan
Jul 06 2016 11:26
u have auto restart in quorra??
Harish
@harishanchu
Jul 06 2016 11:30
Yes there is; only for development purpose
maq
@maqboolkhan
Jul 06 2016 11:30
kooooooollll
just quorra ride will work?
i mean is there any arg to pass?
Harish
@harishanchu
Jul 06 2016 11:30
quorra ride --watch will watch your files for changes based on the configuration defined in /app/config/watch.js
maq
@maqboolkhan
Jul 06 2016 11:31
so awesome man
(Y)
and have u fixed route parameters ?
Harish
@harishanchu
Jul 06 2016 11:31
There is no public documentation about it, but will do soon
maq
@maqboolkhan
Jul 06 2016 11:31
in App.url.route
Harish
@harishanchu
Jul 06 2016 11:31
Yup
maq
@maqboolkhan
Jul 06 2016 11:32
ok m on it
will ping u back
Harish
@harishanchu
Jul 06 2016 11:32
:+1:
maq
@maqboolkhan
Jul 06 2016 11:32
one more suggestion
why i have to use path.resolve while
add SP
it look weird
Harish
@harishanchu
Jul 06 2016 11:32
because there can be three kind of service providers
maq
@maqboolkhan
Jul 06 2016 11:32
ohhhh
plz tell
Harish
@harishanchu
Jul 06 2016 11:40
  • Inbuilt service providers (example: positron/log/LogServiceProvider)
  • Custom Service provider built as a node module
  • Custom service providers
For the last two Quorra, will run just require(<service>) to load the service. Hence for the last one you need to provider absolute path to provider file, else require method will fail to resolve the service provider.
maq
@maqboolkhan
Jul 06 2016 11:41
ohhhhhhhhh
:/
ok ok
m extensively working on Vawy
Vawy makes helper function available on views
for quorra
Harish
@harishanchu
Jul 06 2016 11:43
If you are going to publish it as a node module then you don't need to use full path in your providers config array; npm module name would just work
maq
@maqboolkhan
Jul 06 2016 11:43
ohhhh
got it
but for testing i have to use it with path
:)
Harish
@harishanchu
Jul 06 2016 11:44
for testing modules locally you can your npm link command
maq
@maqboolkhan
Jul 06 2016 11:44
ohhh cool thank u so much
:)
Harish
@harishanchu
Jul 06 2016 11:44
:smile:
maq
@maqboolkhan
Jul 06 2016 11:45
thanks @harishanchu i am learning alot from u
Harish
@harishanchu
Jul 06 2016 11:57
:+1:
maq
@maqboolkhan
Jul 06 2016 13:01
@harishanchu where can i read what new in latest version?
Harish
@harishanchu
Jul 06 2016 13:08
We don't have 1.0.0 release yet
After 1.0.0 release that I will adding release notes with each release
I will be adding contribution guidelines, public road maps etc as well after 1.0.0 release
maq
@maqboolkhan
Jul 06 2016 16:41
okok soon :)
maq
@maqboolkhan
Jul 06 2016 18:18
@harishanchu i have created a npm link so now i can only add path in SP array and it will work ?? no need to require any thing?
Harish
@harishanchu
Jul 06 2016 18:19
Yes
maq
@maqboolkhan
Jul 06 2016 18:21
but
when m using
npm link
it says
@positron/support not found
Harish
@harishanchu
Jul 06 2016 18:22
What did you do exactly?
maq
@maqboolkhan
Jul 06 2016 18:22
same thing created a folder
then middleware and SP
then attach mw with app using SP
its working perfect as local custom SP
Harish
@harishanchu
Jul 06 2016 18:23
Did you create a module
maq
@maqboolkhan
Jul 06 2016 18:23
yes i create a module using npm link
Harish
@harishanchu
Jul 06 2016 18:24
I mean did you create an external npm package before linking
maq
@maqboolkhan
Jul 06 2016 18:24
m sorry did not get ??
Harish
@harishanchu
Jul 06 2016 18:25
Linking is for exposing npm package in development environment without publishing it to npm.com
maq
@maqboolkhan
Jul 06 2016 18:25
yes
i learned how to use it
Harish
@harishanchu
Jul 06 2016 18:25
Did you create an npm package then?
maq
@maqboolkhan
Jul 06 2016 18:25
yess
Harish
@harishanchu
Jul 06 2016 18:26
Show me it's package.json file
maq
@maqboolkhan
Jul 06 2016 18:27
{
  "name": "Vawy",
  "version": "1.0.0",
  "description": "",
  "main": "VawyMiddleware.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}
i guess main got problem
Harish
@harishanchu
Jul 06 2016 18:28
Probably u r using @positron/support module in u r package, but I don't see it as dependency in your package.json
Why?
maq
@maqboolkhan
Jul 06 2016 18:29
ohhhhhhhhhhhhhhhhh
let me fixed this
Harish
@harishanchu
Jul 06 2016 18:29
Also I don't think u can register a package with capcoded name
maq
@maqboolkhan
Jul 06 2016 18:30
ohhhhhh let me fixed all these
Harish
@harishanchu
Jul 06 2016 18:30
Please refer to the package development guides and package.json documentation provided by npm
i am following this
Harish
@harishanchu
Jul 06 2016 18:32
Not about linking
maq
@maqboolkhan
Jul 06 2016 18:32
yes i got u sorry will take care next time :)
Harish
@harishanchu
Jul 06 2016 18:32
:+1:
maq
@maqboolkhan
Jul 06 2016 18:35
can i use upper case filenames?
maq
@maqboolkhan
Jul 06 2016 18:44
ok on it :) thanks
maq
@maqboolkhan
Jul 06 2016 20:49
now this happend :(
vawy/VawyServiceProvider is not an instance of ServiceProvider class
Harish
@harishanchu
Jul 06 2016 20:55
Show me your package.json file
You cannot use vawy/VawyServiceProvider as a module name
maq
@maqboolkhan
Jul 06 2016 20:57
{
  "name": "vawy",
  "version": "1.0.0",
  "description": "",
  "main": "VawyMiddleware.js",
  "dependencies": {
    "@positron/support": "1.0.0-beta"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "Maqbool ur Rahim khan <maqboolurrahim@gmail.com> (http://maqlaboratory.blogspot.com/)",
  "license": "ISC"
}
Harish
@harishanchu
Jul 06 2016 20:57
If vawy is the module then it should expose service as the main file
maq
@maqboolkhan
Jul 06 2016 20:57
ohh got it
here middleware is main
Harish
@harishanchu
Jul 06 2016 20:57
vawy/VawyServiceProvider you cannot use namespaces like php
maq
@maqboolkhan
Jul 06 2016 20:58
then what should i do?
i mean how to add in SP array?
Harish
@harishanchu
Jul 06 2016 20:58
Are u new to nodejs
maq
@maqboolkhan
Jul 06 2016 20:58
yup
just one year experience
and just completed my BS
Harish
@harishanchu
Jul 06 2016 20:58
Guess ur from php background
maq
@maqboolkhan
Jul 06 2016 20:59
yes u r right laravel and simple php
but python
and js is my main point of interest
:)
Harish
@harishanchu
Jul 06 2016 20:59
U need understand how module system works in nodejs
maq
@maqboolkhan
Jul 06 2016 21:00
yes
u r right
Harish
@harishanchu
Jul 06 2016 21:01
It's very different from a class based program like php
maq
@maqboolkhan
Jul 06 2016 21:01
yes i can understand
actually i guess m doing something wrong while adding it into SP array
Harish
@harishanchu
Jul 06 2016 21:02
Node js is single threaded and runs in container like Java
maq
@maqboolkhan
Jul 06 2016 21:02
in app.js
yes i understand
Harish
@harishanchu
Jul 06 2016 21:03
Please refer to some docs get a strong understanding of basics
In our case u should expose the service provider as the main file
maq
@maqboolkhan
Jul 06 2016 21:04
yes
and
Harish
@harishanchu
Jul 06 2016 21:04
You cannot refer to a file inside your module with namespaces like php
maq
@maqboolkhan
Jul 06 2016 21:05
no no @harishanchu i guess u get me wrong
m not doing what u r thinking
Harish
@harishanchu
Jul 06 2016 21:05
If you need to expose something then you should export it from main script file
maq
@maqboolkhan
Jul 06 2016 21:05
yes i understand all these concept
kindly listen
Harish
@harishanchu
Jul 06 2016 21:05
Ok
maq
@maqboolkhan
Jul 06 2016 21:06

'vawy/VawyServiceProvider'

this is how m adding my custom SP into app.js array

and i guess this causing problem
of
vawy/VawyServiceProvider is not an instance of ServiceProvider
Harish
@harishanchu
Jul 06 2016 21:06
That is what I told you
maq
@maqboolkhan
Jul 06 2016 21:07
yes u told me to add this way
so m doing it
Harish
@harishanchu
Jul 06 2016 21:07
You cannot refer to a file inside ur package like that
maq
@maqboolkhan
Jul 06 2016 21:07
plz rememder i have created a node package using link
ohhh then what m doing wrong?
Harish
@harishanchu
Jul 06 2016 21:08
That is what I said above
U cannot use namespace like that
maq
@maqboolkhan
Jul 06 2016 21:08
ohhhhh then
Harish
@harishanchu
Jul 06 2016 21:09
Add your module name to the provider array
maq
@maqboolkhan
Jul 06 2016 21:09
yessssssss
howww?
Harish
@harishanchu
Jul 06 2016 21:09
And ur module should expose service provider as the module main file
maq
@maqboolkhan
Jul 06 2016 21:09
yes its doing now
how can i add it into provider array?
Harish
@harishanchu
Jul 06 2016 21:11
Addy just vawy
If that is ur module name
maq
@maqboolkhan
Jul 06 2016 21:11
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
now i understand whole story
Harish
@harishanchu
Jul 06 2016 21:12
Ok
maq
@maqboolkhan
Jul 06 2016 21:12
but still error occuring
Harish
@harishanchu
Jul 06 2016 21:12
C my chat above
maq
@maqboolkhan
Jul 06 2016 21:13
i guess i should give up on vawy and learn some advance nodejs
then i will start contributing again
Quorra is awesome it will be hit in sha Allah
and u r awesome person :)
Harish
@harishanchu
Jul 06 2016 21:14

And ur module should expose service provider as the module main file

maq 02:39

This was what I'm referring to
Now ur exposing some middleware file as the main file not service provider
maq
@maqboolkhan
Jul 06 2016 21:15
wait m sending u error
i have change main file
C:\Users\maqi\Desktop\component\quorra-test\node_modules\positron\lib\foundation\Application.js:339
    if(provider.indexOf('positron/') === 0) {
                ^

TypeError: provider.indexOf is not a function
and here goes my package.json
{
  "name": "vawy",
  "version": "1.0.0",
  "description": "",
  "main": "VawyServiceProvider.js",
  "dependencies": {
    "@positron/support": "1.0.0-beta"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "Maqbool ur Rahim khan <maqboolurrahim@gmail.com> (http://maqlaboratory.blogspot.com/)",
  "license": "ISC"
}
Harish
@harishanchu
Jul 06 2016 21:17
Yes you should get ur basics right with the nodejs module system. Else it will be difficult for u to get things work properly
Now show me ur service provider file code
maq
@maqboolkhan
Jul 06 2016 21:18
var ServiceProvider = require('@positron/support').ServiceProvider;

var VawyServiceProvider = ServiceProvider.extend(function(app) {
    this.__app = app;
});

VawyServiceProvider.prototype.register = function(done) {
    this.__app.middleware(require('./VawyMiddleware.js'));
    done();
};

module.exports = VawyServiceProvider;
Harish
@harishanchu
Jul 06 2016 21:21
Could you please show me ur providers array as well
maq
@maqboolkhan
Jul 06 2016 21:21
ya ya why not
plz wait while
var vawy = require('vawy');
.
.
'providers': [
        'positron/exception/ExceptionServiceProvider',
        'positron/log/LogServiceProvider',
        'positron/database/ModelServiceProvider',
        'positron/auth/AuthServiceProvider',
        'positron/routing/RoutingServiceProvider',
        'positron/routing/ControllerServiceProvider',
        'positron/view/ViewServiceProvider',
        'positron/encryption/EncryptionServiceProvider',
        'positron/cookie/CookieServiceProvider',
        'positron/session/SessionServiceProvider',
        'positron/translation/TranslationServiceProvider',
        'positron/mail/MailServiceProvider',
        'positron/hashing/HashServiceProvider',
        vawy,
    ],
Harish
@harishanchu
Jul 06 2016 21:22
Now I see the error
maq
@maqboolkhan
Jul 06 2016 21:23
ohhhhh plz/
?
Harish
@harishanchu
Jul 06 2016 21:25
which version of node do you use?
maq
@maqboolkhan
Jul 06 2016 21:25
4.2.1
is there any prblm with node version?
Harish
@harishanchu
Jul 06 2016 21:26
my idea vas just to pass provider as the string like vawy and qurra's positron module to require it
maq
@maqboolkhan
Jul 06 2016 21:27
m really very sorry but i did not get u
:/
Harish
@harishanchu
Jul 06 2016 21:28
but now I see that won't work with older versions of node
but should work with yours I guess
maq
@maqboolkhan
Jul 06 2016 21:29
ohhhh so m doing everything right?
Harish
@harishanchu
Jul 06 2016 21:29
can you pass just 'vawy' string instead of manually requiring it and passing
could you please try that and see what happens
maq
@maqboolkhan
Jul 06 2016 21:30
ok ok
amd changing vawy into 'vawy'
Harish
@harishanchu
Jul 06 2016 21:30
right
maq
@maqboolkhan
Jul 06 2016 21:32
now its saying
vawy is not an instance of ServiceProvider class
:/
Harish
@harishanchu
Jul 06 2016 21:33
ah
maq
@maqboolkhan
Jul 06 2016 21:33
now ?
:(
Harish
@harishanchu
Jul 06 2016 21:33
there is something wrong
let me think
maq
@maqboolkhan
Jul 06 2016 21:34
yes should i send vawy package?
Harish
@harishanchu
Jul 06 2016 21:34
please if you could
maq
@maqboolkhan
Jul 06 2016 21:34
can i attach here?
should i send it hello@quorra.com
or create a git repo?
Harish
@harishanchu
Jul 06 2016 21:35
do you have dropbox?
maq
@maqboolkhan
Jul 06 2016 21:35
nope gdrive and mediafire??
Harish
@harishanchu
Jul 06 2016 21:36
or email it to hello@quorra.com
maq
@maqboolkhan
Jul 06 2016 21:36
ok ok m doing
Harish
@harishanchu
Jul 06 2016 21:36
gdrive please
maq
@maqboolkhan
Jul 06 2016 21:36
ok wait a sec plz
Harish
@harishanchu
Jul 06 2016 21:39
let me try this
maq
@maqboolkhan
Jul 06 2016 21:40
yes
Harish
@harishanchu
Jul 06 2016 21:57
hi @maqboolkhan

There is something wrong with positron source as well. Which I will fix soon and let you know.

But for now you have to comment line numbers 375 to 377 from /node_modules/positron/lib/foundation/Application.js to make this work .

ie, this should be commented

if(!(providerInstance instanceof ServiceProvider)) {
        throw Error('Provider: '+ provider + ' is not an instance of ServiceProvider class');
    }
Thank you for your patience
Harish
@harishanchu
Jul 06 2016 22:23
positron module and vawy module have its own @positron/support dependency. That is the above code throws error. This will work with new versions of npm but not with old one. So I think I will move @positron/support dependency to quorra's package.json instead of positron. Then you can also remove @positron/support dependency from your custom module.
I will make the changes and let you know