Nodeclipse / nodeclipse

Nodeclipse-1 : Eclipse plugin for Node.js, PhantomJS development (Nodeclipse core plugin); Maven and Gradle (with Android) plugins
https://nodeclipse.github.io/
158 stars 78 forks source link

Express 4 support #161

Closed dwwaddell closed 10 years ago

dwwaddell commented 10 years ago

Is there support for Express 4.x.x in Nodeclipse?

ghost commented 10 years ago

If you set "express" version to "latest" in your project package.json dependencies then NPM will install version 4.9.0 — at the time this was written.

I don't see in what Nodeclipse is concerned by any node module's version as this is mostly a coding issue to me: if your app need Express 4.x.x then install Express 4.x.x with NPM.

dwwaddell commented 10 years ago

I have Express 4.x.x installed but when you create a New Project with Nodeclipse, it creates an Express 3.2.6 project.

{ "name": "test2", "version": "0.0.1", "private": true, "scripts": { "start": "node app.js" }, "dependencies": { "express": "3.2.6", "ejs": "*" } }

There are big differences between Express 3.x.x and 4.x.x that need to be changed in the JavaScript as can be seen when you use express-generator (4.x.x) to create a project (which won’t run under Nodeclipse).

ghost commented 10 years ago

Yes - Express 4 is not using connect middleware anymore: http://expressjs.com/migrating-4.html

When you create a new Express 4 project from express-generator it's not a Nodeclipse project - therefore it won't run as node application from Nodeclipse...

But it didn't run either from a terminal for me here...

$ sudo npm install -g express-generator $ express myapp $ cd myapp $ npm install $ node -v $ v0.10.31 $ node app.js $

Node exits without any output — am I missing something important in this process?

Running it as Node application from Nodeclipse node.js process is just terminated:

screen shot 2014-09-12 at 18 22 31

Which is not a surprise as it's not a Nodeclipse project (no project resources - etc): in my understanding an Express 4 project would need to be generated by Nodeclipse to be run from Nodeclipse — as a new project type.

dwwaddell commented 10 years ago

You have to start it with “npm start”.

dwwaddell commented 10 years ago

If you look at package.json, you will see how it starts now:

{ "name": "searchPiper", "version": "0.0.1", "private": true, "script": { "start": "node ./bin/www" },

"dependencies": { "body-parser": "~1.8.1", "cookie-parser": "~1.3.3", "debug": "~2.0.0", "ejs": "~0.8.5", "express": "~4.9.0", "mongodb": "^1.4.10", "mongoose": "^3.8.16", "monk": "^0.9.0", "morgan": "~1.3.0", "passport": "^0.2.1", "passport-twitter": "^1.0.2", "serve-favicon": "~2.1.3" } }

ghost commented 10 years ago

$ npm start

Interesting: what about NPMEclipse then ;+)

ghost commented 10 years ago

node ./bin/www

works too:

{ "name": "myapp", "version": "0.0.0", "private": true, "scripts": { "start": "node ./bin/www" }, "dependencies": { "express": "~4.9.0", "body-parser": "~1.8.1", "cookie-parser": "~1.3.3", "morgan": "~1.3.0", "serve-favicon": "~2.1.3", "debug": "~2.0.0", "jade": "~1.6.0" } }

ghost commented 10 years ago

To summarize, we now have two different issues: 1 - a new project template for Express 4 (connect middleware is now splitted into several modules) 2 - a new "Run As" procedure that loads Express 4 application from ./bin/www

dwwaddell commented 10 years ago

Yes, and that is what you have to put in the Run Configuration to make it work in Eclipse.

dwwaddell commented 10 years ago

I think that will do it. You might want to add the ability to choose between a 3.x and 4.x in the creation process.

ghost commented 10 years ago

How do you set Run Configuration to make it run?

dwwaddell commented 10 years ago

Choose New Configuration, then click Search:

… and start typing “w” and it pops up the matching values:

… choose which folder in “In folders” by double-clicking on it. Or, you can just type in the path i.e. /searchPiper/bin/www

ghost commented 10 years ago

It doen't run for me:

screen shot 2014-09-12 at 21 21 03

screen shot 2014-09-12 at 21 18 26

When I click Run at bottom right of this latter panel nothing happens

dwwaddell commented 10 years ago

This doesn’t always work. I have had apps running for hours and then killed them and they won’t restart.

ghost commented 10 years ago

$ cat .project

<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>myapp</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> </projectDescription>

It's not a Nodeclipse project: <buildSpec> and <natures> elements are empty — so I don't see how it could run in Nodeclipse...

dwwaddell commented 10 years ago

It has run for me on numerous occasions. It created a .project:

<?xml version="1.0" encoding="UTF-8"?>

myPiper org.nodeclipse.ui.NodeNature org.eclipse.wst.jsdt.core.jsNature
dwwaddell commented 10 years ago

So, mine has quit running again. I can’t figure out under what conditions it stops and, more frustrating, what makes it start working again. It is not a complete reboot and it is not creating a New Configuration nor is it starting it in the command line, stopping it, and coming back to Eclipse. When it is running, it is good for several days, typically, before it stops again.

dwwaddell commented 10 years ago

Here it is running again with an External Tools New Configuration:

ext

eclipse ext

How do you get the images in the post? I have tried DnD and "Selecting them" but it just puts in a link. When I reply by email, Github just discards the pictures. Dave

paulvi commented 10 years ago

as Patrick @nodeleaf said

we now have two different issues:

any other questions, please create an issue per question