twilson63 / express-coffee Goto Github PK
View Code? Open in Web Editor NEWA Template for NodeJs Application using Express, CoffeeScript, Jade, Stylus, Nib
Home Page: http://twilson63.github.io/express-coffee
License: MIT License
A Template for NodeJs Application using Express, CoffeeScript, Jade, Stylus, Nib
Home Page: http://twilson63.github.io/express-coffee
License: MIT License
Hello, this isn't really an issue, just a question. I noticed viewing the history that you used to have a Cakefile with build and watch tasks for compiling .coffee files into .js files. With your commit for 1.2RC you switched to simply having server.js require 'coffee-script' and have it interpret .coffee files on the fly. Is there a reason in particular you did that? What kind of performance hit does executing coffee files involve? I'd be grateful for any advice in that regard.
Thanks,
Ben
erm, then I followed the link for http://express-coffee.wilbur.io/ and read the answer:
express-coffee template is made to quickly start putting together an application/prototype. So we have changed the template back to automatically compile the coffee-script when you run your node app.
That makes sense, as it is certainly simpler and easier not to bother with compiling, but perhaps it would be worth leaving the build option for folks who want to move from prototyping to real development and deployment?
http://wilbur.io.s3.amazonaws.com/all.css references from views/layout.jade does not exist anymore
Thanks for setting up this template. I did a clean install and tried the command:
cake test
And I get the following output:
cake test
path.existsSync is now calledfs.existsSync
.
path.exists is now calledfs.exists
.
execvp(): No such file or directory
My environment:
express --version
3.0.0rc1
node --version
v0.8.2
Is this because I'm using Node 0.8?
I'am starting server with:
cake dev
After I want to test my site with ab.
ab -n 1 -c 1 http://127.0.0.1:3001/
This works fine but this
ab -n 2 -c 1 http://127.0.0.1:3001/
works bad... returns:
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)...apr_poll: The timeout specified has expired (70007)
How to fix this ?
My server.js file:
// Generated by CoffeeScript 1.4.0
var app, port;
app = require('./.app');
port = app.port;
app.listen(port, function() {
return console.log("Listening on " + port + "\nPress CTRL-C to stop server.");
});
the mongodb has to be configured at travis in order for tests to pass though.
I know that you guys started linking to a bootstrap cdn, I thought I would mention this bootstrap-stylus repo because it's being actively maintained. The author checks diffs and manually updates stylus libs.
Benefits:
Can anyone confirm cake dev is running on windows 7?
Thank you :)
What should be the express-coffee default, requiring users to build and watch their project or using the coffee-script bootstrap to dynamically load your coffee files?
I would like to make this change with the release of express 3.0
Cloud9 IDE requires the dynamic bootstrap, but I have been using the build and watch lately in combination with node-dev to automatically re-compile and restart my dev environment.
What should be the best practice?
What is the most efficient for new users to get started?
When I first created this template, it worked great for having a quick way to get started, express is changing and I would like this template to change with the new features so it can be a quick on ramp for anyone that would like to use express and coffee-script.
Any Suggestions?
Running cake test dies for me on Linux, as it's calling for files with a different case than the files on disk.
posts_test.coffee
line 3
Post = require process.cwd() + '/.app/models/Post'
should be
Post = require process.cwd() + '/.app/models/post'
---------------------------------------------^
users_test.coffee
line 3
User = require process.cwd() + '/.app/models/User'
should be
User = require process.cwd() + '/.app/models/user'
---------------------------------------------^
I created a quick fix by rapping it in a try / catch so heroku can at least launch. You may want to do something more advanced so its obvious where and what is wrong. As a Rails dev I am used to SQLite just working, this had me scratching my head for a while
src/index.coffee
...
try
mongoose.connect 'mongodb://localhost/testing'
catch e
console.log(e)
Also: Great Job. This pre-build let me get running really quickly.
Added models support+models/views/tests scaffolding in my fork https://github.com/darvin/express-coffee-mvc
Is it possible to integrate into upstream? if yes, i can create pull request
My versions:
(master)$ coffee app.coffee
TypeError: Bad argument
at Object.stat (fs.js:388:11)
at HTTPServer.listen (net.js:1051:19)
at Object.<anonymous> (/users/mike/nodejs/express-coffee/app.coffee:11:7)
at Object.<anonymous> (/users/mike/nodejs/express-coffee/app.coffee:12:4)
at Module._compile (module.js:402:26)
at Object.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script.js:57:25)
at /usr/local/lib/node_modules/coffee-script/lib/command.js:147:29
at /usr/local/lib/node_modules/coffee-script/lib/command.js:115:26
at [object Object].<anonymous> (fs.js:107:5)
at [object Object].emit (events.js:61:17)
and
(master)$ node server.js
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Bad argument
at Object.stat (fs.js:388:11)
at HTTPServer.listen (net.js:1051:19)
at Object.<anonymous> (/users/mike/nodejs/express-coffee/app.coffee:11:7)
at Object.<anonymous> (/users/mike/nodejs/express-coffee/app.coffee:12:4)
at Module._compile (module.js:402:26)
at Object.<anonymous> (/usr/local/lib/node_modules/coffee-script/lib/coffee-script.js:14:21)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at require (module.js:346:19)
at Object.<anonymous> (/users/mike/nodejs/express-coffee/server.js:2:1)
Any thoughts on this? Thanks.
like
$coffee debug server.coffee
I'm sure this is an issue with my lack of understanding but I thought you might be able to clarify. When I add a second line to index.coffee like:
h2 'test'
I always get the error below. No matter what I seem to add, if there is a second line in that file, it blows up.
Error: Parse error on line 1: Unexpected 'IDENTIFIER'
at Object.parseError (/Users/ehauser/working/express-coffee/node_modules/coffeekup/node_modules/coffee-script/lib/parser.js:472:11)
at Object.parse (/Users/ehauser/working/express-coffee/node_modules/coffeekup/node_modules/coffee-script/lib/parser.js:548:22)
at Object.compile (/Users/ehauser/working/express-coffee/node_modules/coffeekup/node_modules/coffee-script/lib/coffee-script.js:29:22)
at Object.compile (/Users/ehauser/working/express-coffee/node_modules/coffeekup/lib/coffeekup.js:186:25)
at Function.compile (/Users/ehauser/working/express-coffee/node_modules/express/lib/view.js:64:33)
at ServerResponse._render (/Users/ehauser/working/express-coffee/node_modules/express/lib/view.js:413:18)
at ServerResponse.render (/Users/ehauser/working/express-coffee/node_modules/express/lib/view.js:313:17)
at Router. (/Users/ehauser/working/express-coffee/app.coffee:9:21)
at done (/Users/ehauser/working/express-coffee/node_modules/express/lib/router/index.js:250:22)
at middleware (/Users/ehauser/working/express-coffee/node_modules/express/lib/router/index.js:244:9)
Anyone interested in working on upgrading express-coffee
to express 4.0?
Thanks
Tom
Trying to add new tests in coffee script inside ./test directory.
But with cake test
command tests run (and count) twice. If test failing error message prints also twice.
Hi, I just cloned express-coffee.
npm install completed successfully, but running cake test gives me:
โ cake test
module.js:340
throw err;
^
Error: Cannot find module 'debug'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object. (/Users/sshingler/src/express-coffee/node_modules/stylus/lib/visitor/evaluator.js:23:13)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
Do you have any idea what could be causing that?
โ npm -v
1.1.69
Please shout if you need any other info.
Thanks,
Steven
to lock down the dependencies?
Thanks for making this express-coffee project, I'm happy to have found it!
I'm having a little trouble with the cake dev
task -- the server won't start and I see an error:
$ cake dev
Watching coffee files
Watching js files and running server
DEBUG: Running node-supervisor with
DEBUG: program 'server'
DEBUG: --watch '.app,views'
DEBUG: --ignore 'undefined'
DEBUG: --extensions 'js|jade'
DEBUG: --exec 'node'
DEBUG: Starting child process with 'node server'
DEBUG: Watching directory '/Users/greg/workspace/self/shortlist_express_coffee/.app' for changes.
DEBUG: Watching directory '/Users/greg/workspace/self/shortlist_express_coffee/views' for changes.
/Users/greg/workspace/self/shortlist_express_coffee/server.js:8
app.listen(port, function() {
^
TypeError: Object #<Object> has no method 'listen'
at Object.<anonymous> (/Users/greg/workspace/self/shortlist_express_coffee/server.js:8:5)
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 Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
DEBUG: Program node server exited with code 8
DEBUG: Starting child process with 'node server'
..... [repeats 3 times]
However, when I commented out either of the lines that pipe the supervisor's output streams to stdout and stderr, there is no error displayed and the server starts. These lines are 96 and 97 in the Cakefile in master@HEAD of as now.
Weird. Any ideas what the problem is?
Brunch.io is an application assembler.
It makes sense to use if if your front end code is using front end mvc's like backbonejs.
It also provides browser autoreload functionality once any client file is changed.
Integrating it with express is pretty straighfoward: express's public dir is actually brunch's public dir!
Brunch would also replace connect-assets.
So, what do you think about it? :)
P.S. I've been personally using it in production for a while now. It is also used at delicious and Uber :P
They current setup is using non-matching versions of bootstrap css vs js files.
This was causing some weird issues to crop up for me.
from views/layouts.jade:
!= css("//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.no-icons.min.css")
//other stuff...
!= js('//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js')
I will go ahead and fix this, bump the bootstrap version to the current 2.2.2, and send a pull request.
It appears some of the package versions are incompatible.
npm http 304 https://registry.npmjs.org/connect
npm ERR! error installing [email protected]
npm ERR! Error: No compatible version found: connect@'>=1.8.5- <1.9.0-'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.6","0.1.0","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.2.5","0.2.6","0.2.7","0.3.0","0.4.0","0.5.0","0.5.1","0.5.2","0.5.3","0.5.4","0.5.5","0.5.6","0.5.7","0.5.8","0.5.9","0.5.10","1.0.0","1.0.1","2.2.2","2.3.0","2.3.1","2.3.2","2.3.3","1.9.1","2.3.4","2.3.5","2.3.6","2.3.7","1.9.2","2.3.8","2.3.9","2.4.0","2.4.1","2.4.2","2.4.3","2.4.4","2.4.5","2.4.6","2.5.0","2.6.0","2.6.1","2.6.2","2.7.0","2.7.1","2.7.2","2.7.3"]
npm ERR! at installTargetsError (/usr/local/lib/node_modules/npm/lib/cache.js:488:10)
npm ERR! at next_ (/usr/local/lib/node_modules/npm/lib/cache.js:438:17)
npm ERR! at next (/usr/local/lib/node_modules/npm/lib/cache.js:415:44)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:408:5
npm ERR! at saved (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:231:7
npm ERR! at Object.oncomplete (fs.js:297:15)
Hi,
This question might look stupid...
I installed express-coffee and it works perfectly. My only issue is I don't know where to put my images folder and how to reach them with jade and stylus.
For my defense, see, I'm a designer and this node express stuff doesn't read at all for me :~( I know how to code with jade and stylus and that's it...
I really like this bootstrap, I just need this extra info about how to set up images folder and how to reach it.
Cheers!
-Adame
Hello, I'm new to the Node and probably do something wrong, but != css('app') is not cached in production mode.
!= css('app') // 516 MS response latency
//!= css('app') // 7 MS response latency
Css link at each request is not changed and looks like
<link rel='stylesheet' href='/css/app-1793ea5a0889a0772f020b0aae293a5b.css'>
If I request CSS directly with the browser, latency is 2MS.
Am I doing something wrong or it's just a bug? I use express coffee and assets version is 2.3.3
Thank you,
Serge
express-coffee index page is run slower 10x than pure expressjs with db connect. Can you give me some suggestion to fix that.
I was thinking of making some changes in the somewhat near future and replacing some (somewhat core) dependencies like:
asset-rack is much easier to configure and write plugins for. connect-assets v3 looks cool but the development is slow and asset-rack already offers the same options and then some
Axis is a Stylus library that is somewhere in between bootstrap and nib.
Express doesn't need consolidate.js to configure it, but I figure if we have it in the code as a sample it'll be easy to swap templates.
Thoughts?
Here is Log:
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
at Server.connect.connectionPool.on.server._serverState (/home/simsun/node/express-coffee/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:530:73)
at EventEmitter.emit (events.js:126:20)
at connection.on._self._poolState (/home/simsun/node/express-coffee/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:104:15)
at EventEmitter.emit (events.js:99:17)
at Socket.errorHandler (/home/simsun/node/express-coffee/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:411:10)
at Socket.EventEmitter.emit (events.js:96:17)
at Socket._destroy.self.errorEmitted (net.js:329:14)
at process.startup.processNextTick.process._tickCallback (node.js:245:9)
DEBUG: Program node server exited with code 1
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.