Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Express 4 support #161

Closed
dwwaddell opened this issue Sep 12, 2014 · 19 comments
Closed

Express 4 support #161

dwwaddell opened this issue Sep 12, 2014 · 19 comments

Comments

@dwwaddell
Copy link

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

@ghost
Copy link

ghost commented Sep 12, 2014

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
Copy link
Author

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
Copy link

ghost commented Sep 12, 2014

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
Copy link
Author

You have to start it with “npm start”.

@dwwaddell
Copy link
Author

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
Copy link

ghost commented Sep 12, 2014

$ npm start

Interesting: what about NPMEclipse then ;+)

@ghost
Copy link

ghost commented Sep 12, 2014

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
Copy link

ghost commented Sep 12, 2014

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
Copy link
Author

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

@dwwaddell
Copy link
Author

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
Copy link

ghost commented Sep 12, 2014

How do you set Run Configuration to make it run?

@dwwaddell
Copy link
Author

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
Copy link

ghost commented Sep 12, 2014

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
Copy link
Author

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

@ghost
Copy link

ghost commented Sep 12, 2014

$ 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
Copy link
Author

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

myPiper org.nodeclipse.ui.NodeNature org.eclipse.wst.jsdt.core.jsNature

@dwwaddell
Copy link
Author

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
Copy link
Author

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
Copy link
Member

paulvi commented Sep 15, 2014

as Patrick @nodeleaf said

we now have two different issues:

any other questions, please create an issue per question

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants