petecoop / generator-express Goto Github PK
View Code? Open in Web Editor NEWAn express generator for Yeoman, based on the express command line tool.
License: MIT License
An express generator for Yeoman, based on the express command line tool.
License: MIT License
Getting this error:
$ npm install generator-express
[email protected] node_modules/generator-express
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
$ yo express
Error: Cannot find module 'lodash'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/generator-express/node_modules/yeoman-generator/lib/util/log.js:3:9)
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)
Hello,
The routes I add in another controller (app/controllers/search.js) doesn't take effect, although they are loaded:
var express = require('express'),
router = express.Router(),
db = require('../models'),
s = require('../data/static');
module.exports = function (app) {
app.use('/recherche', router);
console.log('recherche.js : fonction exportée');
};
router.post('/recherche', function(req, res, next) {
console.log('POST : ' + req);
console.log('recherche.js : /recherche');
res.render('index', {
title: 'title',
s: s // Données statiques
});
});
router.get('/recherche', function(req, res, next) {
console.log('POST : ' + req);
console.log('recherche.js : /recherche');
res.render('index', {
title: 'title',
s: s // Données statiques
});
});
console.log('recherche.js : racine');
And I get :
$ npm start
> [email protected] start /path/to/my-project/04-source
> node index.js
recherche.js : racine
recherche.js : fonction exportée
[404 on POST]
What do you think that can be?
I want to select which view engine to use when starting the project, loading in dependencies for each rather than the current default of jade
Webstorm doesn't like those commas :)
PR will follow.
http://www.youtube.com/watch?v=MTYZzs8ud3E
Addy mentions the future of Yeoman - being able to combine different generators together (mentions Express 👍 ) I would very much like this to happen as combining the Angularjs generator with our generator would be a dream come true for me.
omit the livereload script tag if not in development
In app/models folder, I have following models
airport.coffee
user.coffee
The airport.coffee has one user:
module.exports = (sequelize, DataTypes) ->
Airport = sequelize.define 'Airport',
name: DataTypes.STRING
device_id: DataTypes.STRING
Airport.hasOne User, {as: 'publisher'}
Airport.hasOne User, {as: 'reviewer'}
Airport.hasOne User, {as: 'templater'}
But it not work.
thanks for your help :D
A typical use case when developing locally is to have an express and Angular instances running in parallel. However only one can use live reload.
So, express generator can use nodemon
instead.
Why use javascript and coffeescript together?
PS: I am a newbie :D, So please let me know, what's the motive?
Monthly reminder to update all project dependencies
Because when scanning for models it imports JS-files, not .coffee-files. Here:
var models = glob.sync(config.root + '/app/models/*.js');
in app.js
. Should be:
var models = glob.sync(config.root + '/app/models/*.coffee');
quick fix tho
I'd like to stick in the option of optionally installing a css preprocessor. I'd like to give the user the option of None, SASS, LESS, and Stylus. Thoughts? Concerns?
About time to go through the dependencies and update all
Version [email protected]
I'm not sure is it a bug, but when I created my project (with mvc - the basic version works fine) I get 404 on /css/style.css.
Cheers
I don't know if you think it belongs in this generator, but I wrote a version that optionally sets up Bootstrap. I can clean it up as submit a pull request if you think so.
Would love to see Stylus support.
There is a bit of repetition among the generator types (mvc and basic) in the Gruntfiles, task definitions, generators, etc.. I know I've added to this with some of the stuff that I tacked on recently. May want to explore refactoring these areas a bit to DRY things up. Especially if there are any intentions of adding more types of generators. Looks like the foundation for this is there with the "common" stuff maybe.
Thoughts? Maybe I'm overlooking something?
without this, node_modules folder is including in initial git setup.
I currently don't like how the routing works and find that as a project grows the routes.js
gets too large.
After looking at how kraken-js routes work I will be copying how they handle them and bringing them into the controllers.
Perhaps it's just a quirk of my environment, but .gitignore and .bowerrc were not generated in either Basic or MVC modes. Can someone else reproduce this?
Excuse me. I'm new to grunt and yeoman.
I've tried several generators that have a keyword 'express', and this generator is exactly what I want.
But I didn't find a grunt task to build or deploy the app.
Would anyone please tell me if there is an exist way to generate everything I need to deploy on a server.
Thank you.
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Auto-generated by Node Dependency Check
Just downloaded generator-express through npm. There seems to be an extra "});" in https://github.com/petecoop/generator-express/blob/master/app/templates/mvc/app/controllers/home.js when not using a database.
Hello,
This line : https://github.com/petecoop/generator-express/blob/master/app/templates/mvc/app.js#L15
gave me trouble because not allowing any file.
I replace the condition by file.match(/\.js$/) !== null
and it works great.
I am on OS X 10.9.4, could it be a OS X specific issue ?
Thanks for your work
I'm getting some errors when trying to use this generator. My environment is:
I ran:
yo express
And got the following:
TypeError: Cannot read property 'bold' of undefined
at Object.<anonymous> (/Users/francois/Dev/transcluder.com/node_modules/generator-express/node_modules/yeoman-generator/lib/util/common.js:5:56)
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)
at Object.<anonymous> (/Users/francois/Dev/transcluder.com/node_modules/generator-express/node_modules/yeoman-generator/lib/base.js:91:26)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
Any ideas? Should I be rolling back older versions of yo perhaps?
When using MVC and mongodb I get an error loading up the dev server.
Error: Not Found
at Layer.app.use.res.render.message
I had to use generator-express version 1.0.6 for MVC to work.
Hi guys,
I found this project today and I already love this, extremely useful.
I think we should use a more descriptive configuration file, for example, my config is like:
development: {
root: rootPath,
app: {
name: 'project-name'
},
port: 8080,
db: 'mysql://root:root@localhost:8889/project-name-development'
}
I think that we can turn this in something more auto explanatory like
development: {
root: rootPath,
app: {
name: 'project-name'
},
express: {
port: 8080
},
db: {
username: 'root',
password: 'root',
port: '8889',
database: 'project-name'
},
db: 'mysql://root:root@localhost:8889/project-name-development'
}
I think this is better because in the first time I saw the config files I felt a little bit confused when I saw config/config.js
and config/express.js
, I thought the "config" was to set database and express for express... But... not... Then my error was set host
with the same host of database... and you know, I spend some time trying to figure out what was happening
So, because it, I think a configuration file more auto explanatory or with a lot of comments like this, should be better :)
What you think about this? (Sorry for concordance errors, I'm learning English)
Use Paypal's Adaro: https://github.com/krakenjs/adaro
2.0.0 will bring a lot of updates the the MVC generator in particular, after my continued use of the style.
The release will add choices of view engines, databases and CSS pre-processors to allow people to get up and running faster with their setup of choice.
Hi,
I have a exception while starting grunt
after fresh init with MVC mongo.
No errors on install with node and bower on ubuntu. Do you have an idea, what I did wrong?
[grunt-develop] > /var/www/vergissberlin/nr-soccer/app.js:13
var models = glob.sync(config.root + '/app/models/*.js');
^
[grunt-develop] > ReferenceError: glob is not defined
at Object.<anonymous> (/var/www/vergissberlin/nr-soccer/app.js:13:14)
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:906:3
>> application exited with code 8
Thank you!
André
In bower.json should it say public/components
instead of just components
?
I want to add a choice of databases rather than just MongoDB. Initially I will add MySQL and PostgreSQL.
I chosen 'mvc'.
controller/home.js ,I find that the 'app middleware' isn't enabled~。
For example.
router.get('/', function (req, res, next) {
//cookie is undefined ,because the cookieParser isn't enabled~
console.log(req.cookies);
res.render('index', {
title: 'example'
});
});
I fixed,
config/express.js
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded());
app.use(cookieParser());
app.use(compress());
app.use(express.static(config.root + '/public'));
app.use(methodOverride());
app.use(session({name:'weifangtan',secret: 'asfsadf'}));
app.use(function(req,res,next){
return next();
});
// Add Controllers Config
var controllersPath = __dirname.replace('config','') + '/app/controllers';
fs.readdirSync(controllersPath).forEach(function (file) {
if (file.indexOf('.js') >= 0) {
require(controllersPath + '/' + file)(app);
}
});
app.js
//Remove!
// var controllersPath = __dirname + '/app/controllers';
// fs.readdirSync(controllersPath).forEach(function (file) {
// if (file.indexOf('.js') >= 0) {
// require(controllersPath + '/' + file)(app);
// }
// });
require('./config/express')(app, config);
I think express-handlebars is becoming a useful option. Anyone opposed to adding this as another view engine?
Would be great to have i18n already configured.
node v0.10.17, yeoman-generator 0.12.3
after installing generator-express i try to run yo express and get the following:
TypeError: Cannot read property 'bold' of undefined
at Object. (/usr/local/lib/node_modules/generator-express/node_modules/yeoman-generator/lib/util/common.js:5:56)
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)
at Object. (/usr/local/lib/node_modules/generator-express/node_modules/yeoman-generator/lib/base.js:91:26)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
Thanks for any help!
Monthly reminder to update all project dependencies
There should I a place for putting middleware modules, like there is for controllers and models. Probably app/middleware/
.
A company I am working for needs to write a dozen or so middleware components for Express and we need to organize them. I would like to be able to tell them of a standard location to put middleware modules, but the community has not decided where these should go.
Also, each of their middleware modules is dozens of lines of code, so placing them in app/express.js
is not well organized.
because gulp is awesome
Monthly reminder to update all project dependencies
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.