bigcompany / big Goto Github PK
View Code? Open in Web Editor NEWSmall application framework. Solves the domain problem of building web applications.
Home Page: http://big.vc
License: MIT License
Small application framework. Solves the domain problem of building web applications.
Home Page: http://big.vc
License: MIT License
As I try to build an app with big, I don't know how to implement it.
I want to serve static files at the root url, and use these resources :
api, admin, socket, repl, datasource, creature, and maybe more in the future (like irc)
The served js will use the api and the websocket to make requests to the server.
But I don't really get how to mix example apps together
Can you give me some hints please ?
Maybe it's due to my local setup, but install process is a little different for me.
If I try to follow instructions :
npm install big
This tries to install 'big' on my global node_module dir.
So I have to mkdir node_module into my big application dir or create a package.json.
Once 'big' package properly installed, and with example code written in server.js, I run it :
node server.js
This throws an error :
Error: Cannot find module 'resource'
I have to install 'resource' manually or to add it in package.json.
Same for 'resources'.
I run server again, it starts to install resources dependencies and throws error:
node server.js
info: installing system to /home/nc/projects/bigTest/resources/system
info: installing view to /home/nc/projects/bigTest/resources/view
info: installing datasource to /home/nc/projects/bigTest/resources/datasource
info: installing hook to /home/nc/projects/bigTest/resources/hook
info: installing forms to /home/nc/projects/bigTest/resources/forms
info: installing http to /home/nc/projects/bigTest/resources/http
warn: admin resource is missing a required dependency: connect
warn: admin resource is missing a required dependency: highlight
warn: spawning npm to install missing dependencies
exec: npm install connect@2.7.1 highlight@0.2.3
warn: deffering execution of `admin.start` since dependencies are missing
npm http GET https://registry.npmjs.org/highlight/0.2.3
npm http GET https://registry.npmjs.org/connect/2.7.1
npm http 304 https://registry.npmjs.org/highlight/0.2.3
npm http 304 https://registry.npmjs.org/connect/2.7.1
npm http GET https://registry.npmjs.org/qs/0.5.1
npm http GET https://registry.npmjs.org/formidable/1.0.11
npm http GET https://registry.npmjs.org/fresh/0.1.0
npm http GET https://registry.npmjs.org/crc/0.2.0
npm http GET https://registry.npmjs.org/bytes/0.1.0
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/cookie-signature/0.0.1
npm http GET https://registry.npmjs.org/send/0.1.0
npm http GET https://registry.npmjs.org/cookie/0.0.5
npm http GET https://registry.npmjs.org/pause/0.0.1
npm http 304 https://registry.npmjs.org/formidable/1.0.11
npm http 304 https://registry.npmjs.org/qs/0.5.1
npm http 304 https://registry.npmjs.org/crc/0.2.0
npm http 304 https://registry.npmjs.org/fresh/0.1.0
npm http 304 https://registry.npmjs.org/bytes/0.1.0
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/cookie-signature/0.0.1
npm http 304 https://registry.npmjs.org/send/0.1.0
npm http 304 https://registry.npmjs.org/cookie/0.0.5
npm http 304 https://registry.npmjs.org/pause/0.0.1
npm http GET https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/mime/1.2.6
npm http 304 https://registry.npmjs.org/mime/1.2.6
npm http 304 https://registry.npmjs.org/range-parser/0.0.4
highlight@0.2.3 node_modules/highlight
connect@2.7.1 node_modules/connect
├── fresh@0.1.0
├── pause@0.0.1
├── cookie-signature@0.0.1
├── bytes@0.1.0
├── cookie@0.0.5
├── crc@0.2.0
├── debug@0.7.0
├── formidable@1.0.11
├── qs@0.5.1
└── send@0.1.0 (range-parser@0.0.4, mime@1.2.6)
info: npm just exited with code 0
info: npm installation complete
warn: now executing 1 defferred call(s)
warn: http resource is missing a required dependency: express
warn: http resource is missing a required dependency: request
warn: spawning npm to install missing dependencies
exec: npm install express@3.0.4 request@2.12.0
warn: deffering execution of `http.listen` since dependencies are missing
/home/nc/projects/bigTest/resources/admin/index.js:40
resource.http.app.use(connect.static(__dirname + '/public'));
^
TypeError: Cannot call method 'use' of undefined
at listen (/home/nc/projects/bigTest/resources/admin/index.js:40:21)
at execute (/home/nc/projects/bigTest/node_modules/resource/index.js:651:27)
at /home/nc/projects/bigTest/node_modules/resource/index.js:358:16
at beforeHooks (/home/nc/projects/bigTest/node_modules/resource/index.js:420:16)
at /home/nc/projects/bigTest/node_modules/resource/index.js:349:14
at beforeAllHooks (/home/nc/projects/bigTest/node_modules/resource/index.js:389:16)
at Array.fn (/home/nc/projects/bigTest/node_modules/resource/index.js:340:12)
at Array.args.(anonymous function) [as 1] (/home/nc/projects/bigTest/node_modules/resource/index.js:331:12)
at ChildProcess.resource.installDeps (/home/nc/projects/bigTest/node_modules/resource/index.js:263:27)
at ChildProcess.EventEmitter.emit (events.js:99:17)
I run it again :
node server.js
warn: view resource is missing a required dependency: cheerio
warn: spawning npm to install missing dependencies
exec: npm install cheerio@0.9.x
warn: deffering execution of `view.create` since dependencies are missing
info: admin server started on http://0.0.0.0:8888/admin
help: username and password is: admin
npm http GET https://registry.npmjs.org/cheerio
npm http 304 https://registry.npmjs.org/cheerio
npm http GET https://registry.npmjs.org/cheerio-select
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/entities
npm http GET https://registry.npmjs.org/htmlparser2
npm http 304 https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/cheerio-select
npm http 304 https://registry.npmjs.org/entities
npm http 304 https://registry.npmjs.org/htmlparser2
npm http GET https://registry.npmjs.org/CSSselect
npm http GET https://registry.npmjs.org/domelementtype
npm http GET https://registry.npmjs.org/domutils
npm http GET https://registry.npmjs.org/domhandler
npm http 304 https://registry.npmjs.org/CSSselect
npm http 304 https://registry.npmjs.org/domutils
npm http 304 https://registry.npmjs.org/domelementtype
npm http 304 https://registry.npmjs.org/domhandler
npm http GET https://registry.npmjs.org/CSSwhat
npm http 304 https://registry.npmjs.org/CSSwhat
cheerio@0.9.2 node_modules/cheerio
├── entities@0.1.1
├── underscore@1.4.3
├── htmlparser2@2.5.1 (domelementtype@1.1.0, domutils@1.0.1, domhandler@2.0.1)
└── cheerio-select@0.0.3 (CSSselect@0.3.0)
info: npm just exited with code 0
info: npm installation complete
warn: now executing 1 defferred call(s)
I go to : http://admin:admin@localhost:8888/admin
I get this error :
TypeError: Cannot read property 'index' of undefined
at /home/nc/projects/bigTest/resources/admin/index.js:49:9
at callbacks (/home/nc/projects/bigTest/node_modules/express/lib/router/index.js:160:37)
at module.exports (/home/nc/projects/bigTest/node_modules/connect/lib/middleware/basicAuth.js:96:9)
at callbacks (/home/nc/projects/bigTest/node_modules/express/lib/router/index.js:160:37)
at param (/home/nc/projects/bigTest/node_modules/express/lib/router/index.js:134:11)
at pass (/home/nc/projects/bigTest/node_modules/express/lib/router/index.js:141:5)
at Router._dispatch (/home/nc/projects/bigTest/node_modules/express/lib/router/index.js:169:5)
at Object.router (/home/nc/projects/bigTest/node_modules/express/lib/router/index.js:32:10)
at next (/home/nc/projects/bigTest/node_modules/connect/lib/proto.js:190:15)
at resume (/home/nc/projects/bigTest/node_modules/connect/lib/middleware/static.js:60:7)
GET /admin 500 6ms - 950
I run server again, this time all seems ok, I'm able to create resources and execute their methods.
node server.js
Using /public with http resource overrides /resource/admin/public, so the admin css and js files are not loaded.
You can have a look at my setup here :
https://gist.github.com/4697464#file-server-js
https://gist.github.com/4697464#file-tree
https://gist.github.com/4697464#file-view_layout-html
Besides, I don't understand where and how js files are loaded in admin resource.
when run "npm install big -g" will show this error:
RR! Error: ENOENT, open 'e:\tmp\npm-1363888600165\1363888600165-0.8591159207280725\package\db\node\biginternetcompany.net:8888.json'
because file biginternetcompany.net:8888.json have colon char, can't create file in window.
I installed big in a local node_modules folder and started a webserver just using the admin resource. It threw errors for missing both resource & resources modules.
EDIT: i had no idea when opening this issue that big already has a bin script that uses the cli resource. since that is already done the focus of this issue is on modularizing resources out of the 'resources' collection and making a few resources targeted at big development .
i'd like to propose a possible roadmap for big v0.5.0. i'd like to make a big workflow based on http://yeoman.io/. i think this is a good roadmap because it will require the completion of many changes that should be completed anyway, most important imo is making all the resources independent and packaged on npm.
so for example:
big app new mybigapp
should make a new directory called mybigapp with proper big app scaffolding (requires bigcompany/resources#18)
big resource new mybigresource
should make a new directory called mybigresource with proper big resource scaffolding (requires bigcompany/resources#41)
big resource use abigresource
should install abigresource to be used by the big script using the cli (will think about this more to see if a change to the docs resource is really warranted)
big docs markdown <resource>
should either generate README.md for all resources or if given resource, for that resource
big package npm <resource>
should either generate package.json for all resources or if given resource, for that resource (requires bigcompany/resources#14)
just some thoughts, will update with any new ideas. feedback appreciated.
Hi,
just downloaded big to try and launch the example of api with node api
:
[...]
event: logger::log
event: logger::log
big/node_modules/resource/lib/load.js:60
throw err;
^
RangeError: Maximum call stack size exceeded
There is 11 lines of code (including white lines) in https://github.com/bigcompany/big/blob/master/bin/big. Looks like a bug...
When using repl and admin like this :
big.admin.start(function (err, server) {
big.repl.start();
});
All creature view (http://0.0.0.0:8888/admin/resources/creature/all) doesn't display creatures list
Example:
go to asdf.big.vc
and you will get
unknown host: asdf.big.vc
available hosts are [
{
"id": "www.big.vc",
"host": "www.big.vc",
"path": "/public/big.vc"
},
{
"id": "big.vc",
"host": "big.vc",
"path": "/public/big.vc"
},
{
"id": "www.marak.com",
"host": "www.marak.com",
"path": "/public/marak.com"
},
{
"id": "dev.big.vc",
"host": "dev.big.vc",
"path": "/public/dev.big.vc"
},
{
"id": "dev.marak.com",
"host": "dev.marak.com",
"path": "/public/marak.com"
},
{
"id": "marak.com",
"host": "marak.com",
"path": "/public/marak.com"
}
]
maybe this is intentional for dev?
Using this setup
server.js
big.http.listen(function(err, server) {
big.admin.start();
big.socket.start();
});
client.js
var socket = io.connect();
throws this error :
/home/nc/projects/bigServer/node_modules/socketful/lib/engines/socketio.js:19
socket.on(resource.lowerResource, function (action, payload, callback) {
^
TypeError: Cannot read property 'lowerResource' of undefined
at engine.createServer (/home/nc/projects/bigServer/node_modules/socketful/lib/engines/socketio.js:19:25)
at Array.forEach (native)
at SocketNamespace.engine.createServer (/home/nc/projects/bigServer/node_modules/socketful/lib/engines/socketio.js:10:15)
at SocketNamespace.EventEmitter.emit [as $emit] (events.js:126:20)
at connect (/home/nc/projects/bigServer/node_modules/socketful/node_modules/socket.io/lib/namespace.js:292:10)
at /home/nc/projects/bigServer/node_modules/socketful/node_modules/socket.io/lib/namespace.js:308:13
at SocketNamespace.authorize (/home/nc/projects/bigServer/node_modules/socketful/node_modules/socket.io/lib/namespace.js:252:5)
at SocketNamespace.handlePacket (/home/nc/projects/bigServer/node_modules/socketful/node_modules/socket.io/lib/namespace.js:302:14)
at Manager.handleClient (/home/nc/projects/bigServer/node_modules/socketful/node_modules/socket.io/lib/manager.js:697:32)
at Manager.handleUpgrade (/home/nc/projects/bigServer/node_modules/socketful/node_modules/socket.io/lib/manager.js:618:8)
The total size of the big library should be reduced to zero lines.
resource.use
should not automatically trigger the installation of resource dependencies. Will require updates to resource
and resources
package.
The install instructions say npm install big
but then use big
as a command line executable, implying it should be npm install big -g
.
Once installed globally, I follow the rest of the readme instructions and I get this error:
00:32:49:[email protected]:/Users/balupton/Projects:master
$ git clone git://github.com/bigcompany/big.git
Cloning into 'big'...
remote: Counting objects: 1572, done.
remote: Compressing objects: 100% (1085/1085), done.
remote: Total 1572 (delta 535), reused 1432 (delta 395)
Receiving objects: 100% (1572/1572), 870.11 KiB | 153 KiB/s, done.
Resolving deltas: 100% (535/535), done.
00:32:59:[email protected]:/Users/balupton/Projects:master
$ cd big
00:33:00:[email protected]:/Users/balupton/Projects/big:master
$ big admin start
info: installing .npmignore to /Users/balupton/.nvm/v0.8.18/lib/node_modules/big/resources/.npmignore
fs.js:500
return binding.readdir(pathModule._makeLong(path));
^
Error: ENOTDIR, not a directory '/Users/balupton/.nvm/v0.8.18/lib/node_modules/big/node_modules/resources/.npmignore'
at Object.fs.readdirSync (fs.js:500:18)
at Object.helper.copyDir (/Users/balupton/.nvm/v0.8.18/lib/node_modules/big/node_modules/resource/lib/helper.js:4:16)
at EventEmitter.module.exports [as load] (/Users/balupton/.nvm/v0.8.18/lib/node_modules/big/node_modules/resource/lib/load.js:67:12)
at EventEmitter.module.exports [as use] (/Users/balupton/.nvm/v0.8.18/lib/node_modules/big/node_modules/resource/lib/use.js:22:21)
at /Users/balupton/.nvm/v0.8.18/lib/node_modules/big/node_modules/resources/index.js:28:12
at Array.forEach (native)
at Object.<anonymous> (/Users/balupton/.nvm/v0.8.18/lib/node_modules/big/node_modules/resources/index.js:27:12)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
00:33:03:[email protected]:/Users/balupton/Projects/big:master
$
``
Running `node apps/admin` worked however.
I've been following big and resource for a while and I see some amazing aspects but I can't be quite sure I totally get the whole picture. I myself don't have a computer science degree so this doesn't mean as much as it should:
".. a next generation application zero-framework which solves the domain problem of building web applications"
What does this mean in practical terms? Can you show the users how big and resource would improve their application development? What is the 'domain problem' in node.js and how to we use big to solve it? What is the pattern you think is the right way to use big?
Maybe a small philosophy explanation, an annotated demo application or a comparison with the lesser alternatives would make adoption easier.
When running a basic app such as:
var big = require('big')
big.use('admin')
big.admin.start(function (err, server) {
big.logger.info('started server')
})
visiting localhost:8888/admin will result in the following error on stdout:
warn: invalid view path /Users/luke/Repos/endgame.io/view unable to load view
(note that the same error happens on the admin demo app)
This can be solved by copying the admin's view directory to the current working directory of the application's main script. It looks to be an issue with the manner in which paths are resolved for view
directories, perhaps in node_modules/resources/view/index.js
.
○ → big
/usr/local/Cellar/node/0.8.15/lib/node_modules/big/node_modules/resource/node_modules/mkdirp/index.js:74
throw err0;
^
Error: EACCES, permission denied '/usr/local/Cellar/node/0.8.15/lib/node_modules/big/resources'
at Object.fs.mkdirSync (fs.js:483:18)
at sync (/usr/local/Cellar/node/0.8.15/lib/node_modules/big/node_modules/resource/node_modules/mkdirp/index.js:55:12)
at Function.sync (/usr/local/Cellar/node/0.8.15/lib/node_modules/big/node_modules/resource/node_modules/mkdirp/index.js:61:24)
at EventEmitter.module.exports [as load] (/usr/local/Cellar/node/0.8.15/lib/node_modules/big/node_modules/resource/lib/load.js:66:12)
at EventEmitter.module.exports [as use] (/usr/local/Cellar/node/0.8.15/lib/node_modules/big/node_modules/resource/lib/use.js:22:21)
at /usr/local/Cellar/node/0.8.15/lib/node_modules/big/node_modules/resources/index.js:36:35
at Array.forEach (native)
at Object.<anonymous> (/usr/local/Cellar/node/0.8.15/lib/node_modules/big/node_modules/resources/index.js:35:12)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.