Giter Site home page Giter Site logo

express-train's People

Contributors

chris-langager avatar creynders avatar erin-noe-payne avatar jacksonhoose avatar pvencill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

express-train's Issues

Problem with express.bodyParser() middleware

I am not sure if this is an issue with express-train, or something I am doing wrong.

When using the express-train boilerplate template, there seems to be an issue with the express.bodyParser() middleware.

In '/lib/middleware.js' is:

app.use(express['static'](app.set('public')));                                              
app.use(connect_timeout({ time:app.config.request_timeout }));   
app.use(express.cookieParser());                            
app.use(session_middleware);        
app.use(express.bodyParser());                                  
app.use(express.methodOverride());                      
app.use(app.router);         

However in the logs of train, I never see the statement:

' middleware / bodyParser'

and the req.body is always undefined.

If in my route, I add express.bodyParser() before the controller function, the req.body is defined correctly:

app.post('/feature',express.bodyParser(), app.controllers.home.createFeature)

Please let me know if you need more info.

Thanks,
Dan

Why use this over Base 12?

not an issue, just a question

they both look pretty similar to me so what are the advantages of picking this over Base 12?

Train console and overridden locations

Train console does not require from app/index.js. So it will not take into account any overridden locations.

Right now the assumption is that index.js actually causes the server to listen - for easier use with run and cycle, but that prevents use with console. Solve it!

socket.io

I was thinking about adding socket.io support and started with something like this:

app/lib/events.js:

var socketio = require('socket.io');
module.exports = function (app) {
app.io = socketio.listen(app.server);
app.io.configure(function () { app.io.set("log level", 3); ... });
// Event mapping
app.io.sockets.on("connection", function (socket) { ... } );
}

Does it look ok under the framework standards?

app loadConfigs indeterminate behavior

Locations can be overwritten at createapplication.

If a user gives a .json file rather than a directory for configs, loadConfigs will attempt to select [NODE_ENV] off of this object. Could cause unintended behavior if a .json file has an object with keys that collide with [NODE_ENV] or with "default"

Please ensure that you set the default write concern for the database by setting one of the options

The below is in outputted to my console after initial run of my newly scaffolded app. Any ideas on how to get rid of the below message?

DEBUG: Starting child process with 'node app/index.js'
========================================================================================
=  Please ensure that you set the default write concern for the database by setting    =
=   one of the options                                                                 =
=                                                                                      =
=     w: (value of > -1 or the string 'majority'), where < 1 means                     =
=        no write acknowlegement                                                       =
=     journal: true/false, wait for flush to journal before acknowlegement             =
=     fsync: true/false, wait for flush to file system before acknowlegement           =
=                                                                                      =
=  For backward compatibility safe is still supported and                              =
=   allows values of [true | false | {j:true} | {w:n, wtimeout:n} | {fsync:true}]      =
=   the default value is false which means the driver receives does not                =
=   return the information of the success/error of the insert/update/remove            =
=                                                                                      =
=   ex: new Db(new Server('localhost', 27017), {safe:false})                           =
=                                                                                      =
=   http://www.mongodb.org/display/DOCS/getLastError+Command                           =
=                                                                                      =
=  The default of no acknowlegement will change in the very near future                =
=                                                                                      =
=  This message will disappear when the default safe is set on the driver Db           =
========================================================================================
[express train application listening on 4000]

Cannot give absolute path to overwrite config location

When trying to overwrite the config location, absolute paths do not work:

var tree = train(__dirname, {config: {path: '/absolute/path/to/dir'}});

Gets an error when starting the app:

Error: ENOENT, no such file or directory '/relative/path/to/app/absolute/path/to/dir'

Cannot run tests

When I try to run the tests, I get an error:

     Error: Cannot find module '/express-train-fork/test/scaffold/app/models'
      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 traverseAndRegister (/express-train-fork/lib/app.js:107:22)
      at /express-train-fork/lib/app.js:67:9
      at Function.forEach (/express-train-fork/node_modules/lodash/dist/lodash.js:3039:15)
      at ExpressTrain (/express-train-fork/lib/app.js:66:7)
      at Context.<anonymous> (/express-train-fork/test/app.js:55:18)
      at Test.Runnable.run (/express-train-fork/node_modules/mocha/lib/runnable.js:211:32)
      at Runner.runTest (/express-train-fork/node_modules/mocha/lib/runner.js:358:10)
      at /express-train-fork/node_modules/mocha/lib/runner.js:404:12
      at next (/express-train-fork/node_modules/mocha/lib/runner.js:284:14)
      at /express-train-fork/node_modules/mocha/lib/runner.js:293:7
      at next (/express-train-fork/node_modules/mocha/lib/runner.js:237:23)
      at Object._onImmediate (/express-train-fork/node_modules/mocha/lib/runner.js:261:5)
      at processImmediate [as _immediateCallback] (timers.js:330:15)

Are the scaffold helper files simply missing, or is there some magic going on I'm not aware of? ๐Ÿ˜
Do I simply yo express-train into a test/scaffold directory?

Document testing

Write clearer docs for how to write tests taking advantage of Nject

BUG: Tries to require any type of file for injection

With commit bdd432b the traversal of files and directories for automatic dependency injection was changed which introduced a really nasty bug: express-train tries to require any kind of file in those directories, so now it chokes on .DS_store files etc.

/project/bootstrap/.DS_Store:1
(function (exports, require, module, __filename, __dirname) { 
                                                              ^
Exiting process due to uncaught exception!
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:439:25)
    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 traverseAndRegister (/project/node_modules/express-train/lib/app.js:114:21)
    at /project/node_modules/express-train/lib/app.js:110:13
    at Array.forEach (native)
    at traverseAndRegister (/project/node_modules/express-train/lib/app.js:108:15)

Some kind of file type filtering seems in order.

scaffolding help?

Anything I can do to help develop rails-like scaffolding? Is there already a skeleton or current attempt?

Make app.start better!

app.start expects http or https on the config object, creates http and https servers (should probably be the job of nginx or something else in the architecture).

Mov from lifecycle stages to dependency tree & DI

I am proposing to drop Express Train's lifecycle stages and move to an angular-style dependency injection system. At run time each file is registered by file name, and dependencies are resolved by variable. A dependency tree is built and each module is resolved in the order needed to run the app.

app.get('public') and app.get('views') is undefined when using "overriding app"

I fixed it by changing my app.js into this:

var expressio = require('express.io');
var path = require('path');

module.exports = function(){
    var app = expressio();
    app.set('views', path.join(__dirname, "../views"));
    app.set('public', path.join(__dirname, "../public"));
    return app;
}
Error: static() root path required
    at Function.module.exports (C:\Users\fraherm\workspace\test\node_modules\express\node_modules\connect\lib\middleware\static.js:49:20)
    at module.exports (C:\Users\fraherm\workspace\test\app\lib\middleware.js:28:30)
    at C:\Users\fraherm\workspace\test\node_modules\express-train\node_modules\nject\lib\nject.js:180:33
    at Array.forEach (native)
    at Function._.each._.forEach (C:\Users\fraherm\workspace\test\node_modules\express-train\node_modules\nject\node_modules\underscore\underscore.js:78:11)
    at Tree.resolve (C:\Users\fraherm\workspace\test\node_modules\express-train\node_modules\nject\lib\nject.js:167:7)
    at createApplication (C:\Users\fraherm\workspace\test\node_modules\express-train\lib\app.js:92:17)
    at Object.<anonymous> (C:\Users\fraherm\workspace\test\app\index.js:3:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

Implementing basic Passport Local strategy for authentication

This would be more of a feature request, can it be possible to implement a boilerplate template which has basic passpost-local & mongoose integration done, maybe follwoing this example https://github.com/jaredhanson/passport-local/tree/master/examples/express3-mongoose-rememberme .

This would save time and energy and makes it quickly to jump on matters that matter most, rather than handling repetitive patterns every time a new project starts.

Nodejitsu Deployment Fails

Hi

I generated the boilerplate and when trying to deploy to Nodejitsu, it fails due to the startup script. Kindly advise.

Thanks.

typo in readme

... express train and is you express application...

Should be
...express train and is youR express application...

Allow for use of express 4

Right now express-train has express 3 as a dependency and creates the server using it.

There is no way to specify which version of express you want to use.

Would it be possible to add that configuration in?

Thanks in advance,
Dan

middleware parameters

Hi,

When using a default app and getting non existing URL the default error handler middleware express.errorHandler can't find req.headers.

"version": "0.0.22"

$ train new app
$ cd app
$ train run
...
[ express-train ] application listening on port 4000

GET /x
middleware / query 0ms
middleware / expressInit 1ms
middleware / static 2ms
middleware / responseTimeout 0ms
middleware / cookieParser 1ms
middleware / session 4ms
middleware / bodyParser 0ms
middleware / methodOverride 0ms
middleware / router
0ms
middleware / errorHandler undefined
TypeError: Cannot read property 'accept' of undefined
at errorHandler (/tmp/app/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js:49:29)
at Object.handle (/tmp/app/node_modules/express-trace/lib/express-trace.js:106:9)
at next (/tmp/app/node_modules/express/node_modules/connect/lib/proto.js:190:15)
at /tmp/app/node_modules/express-trace/lib/express-trace.js:109:11
at pass (/tmp/app/node_modules/express/lib/router/index.js:107:24)
at Router._dispatch (/tmp/app/node_modules/express/lib/router/index.js:170:5)
at router (/tmp/app/node_modules/express/lib/router/index.js:33:10)
at Object.handle (/tmp/app/node_modules/express-trace/lib/express-trace.js:106:9)
at next (/tmp/app/node_modules/express/node_modules/connect/lib/proto.js:190:15)
at /tmp/app/node_modules/express-trace/lib/express-trace.js:109:11

responded to GET /x in 18ms with 500 "Internal Server Error"

Can't run app with express-train

Hi,

I'm not sure why, but when I try to run my app using [email protected] and [email protected], I'm getting the following error when trying to run my app. I tried using the generator (generator-express-train) and kept getting similar errors with the setup that was generated too.

Error:

$ node app/index.js 

[2016-02-29 19:31:58.846] [LOG]   Configuring Express-Train from file: ../config

/home/mrodrig/lvm/node_modules/express-train/lib/app.js:136
      throw new Error(file.path+': '+err)
      ^

Error: /home/mrodrig/lvm/node_modules/abbrev/CONTRIBUTING.md: SyntaxError: Unexpected identifier
    at /home/mrodrig/lvm/node_modules/express-train/lib/app.js:136:13
    at forOwn (/home/mrodrig/lvm/node_modules/lodash/dist/lodash.js:1907:15)
    at Function.forEach (/home/mrodrig/lvm/node_modules/lodash/dist/lodash.js:3044:9)
    at ExpressTrain (/home/mrodrig/lvm/node_modules/express-train/lib/app.js:131:5)
    at Object.<anonymous> (/home/mrodrig/lvm/app/index.js:27:12)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:140:18)
    at node.js:1001:3

Here's my express-train config in index.js:

var tree = train(__dirname,
    {
        config: {path: environment.etFileLocation}
    });

Is there something wrong here? Why is it looking in the node_modules directory?

Thanks in advance!

Train new fails on Windows 7 x64 with unhandled 'error' event

When trying to create new train projects on windows with the latest npm build, train will fail with an unhandled error event.
I believe that Windows path concatenation should be handled differently than linux systems. On the other hand, the Train Angular Seed project can be started with no issues, the issue that I've found only impacts the new command.

Here is the cmd output:

C:\Users\gabriel\test>train new testme
Your boilerplate preferences file was written to C:\Users\gabriel.node-boilerplate.json
Your boilerplate preferences file was written to C:\Users\gabriel.node-boilerplate.json

events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)

document the 'new' routes folder

I am migrating some older code to the latest version. I used a routes.js in my lib folder, but now there is a routes folder in the root when using yeoman. Please explain the migration?

Boilerplate out of date?

Following the basic setup in the README, I get the error trying to do train run:

Exiting process due to uncaught exception!
TypeError: Object [object Object] has no method 'start'
    at Command.<anonymous> (/usr/local/share/npm/lib/node_modules/express-    train/bin/commands/run.js:10:26)
    at Command.<anonymous> (/usr/local/share/npm/lib/node_modules/express-    train/node_modules/commander/index.js:249:8)
    at Command.EventEmitter.emit (events.js:98:17)
    at Command.parseArgs (/usr/local/share/npm/lib/node_modules/express-train/node_modules/commander/index.js:477:12)
    at Command.parse (/usr/local/share/npm/lib/node_modules/express-train/node_modules/commander/index.js:370:21)
    at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/express-train/bin/train:18: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)

Digging into the source it looks like in the project root index.js it calls require('./app/index.js').start(); and the ./app/index returns train(__dirname);, and looking at the source there's no start() method in the train object anymore. I can update the boilerplate, but what's the correct syntax now?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.