| Summary: | Migrating the Node server from Connect to Express | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Chen-Yu Kevin Leong <c2leong> |
| Component: | Node | Assignee: | Mark Macdonald <mamacdon> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | maciej.bendkowski, mamacdon, pwebster |
| Version: | 10.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows NT | ||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=488342 | ||
| Whiteboard: | |||
|
Description
Chen-Yu Kevin Leong
Hi Mark, I am working on migrating node-orion from Connect to Express. I found many documentations and tutorials on Express, but was unable to find many documentations or tutorials on Connect. So I was hoping you could provide me with some hints as to what Express does that Connect doesn't and why we are trying to perform the migration. Thanks, Kevin (In reply to Chen-Yu Kevin Leong from comment #1) > I found many > documentations and tutorials on Express, but was unable to find many > documentations or tutorials on Connect. Have you visited their official github page [1]? You could also take a look at [2] - a short introduction guide to connect. [1] https://github.com/senchalabs/connect [2] http://stephensugden.com/middleware_guide/ (In reply to Maciej Bendkowski from comment #2) > (In reply to Chen-Yu Kevin Leong from comment #1) > > I found many > > documentations and tutorials on Express, but was unable to find many > > documentations or tutorials on Connect. > > Have you visited their official github page [1]? You could also take a look > at [2] - a short introduction guide to connect. > > [1] https://github.com/senchalabs/connect > [2] http://stephensugden.com/middleware_guide/ I had not read [2]. I shall read it now. Thanks for the links. Files I made edits to:
index.js
server.js
- wrote code for basic-auth
- wrote code for express
- created an express app
- created a http server
file.js
- wrote code for express
- wrote code for express-json
git.js
- wrote code for express
- wrote code for express-json
orion_static.js
- wrote code for mime
- wrote code for express
- wrote code for express.static
orionnode_static.js
- wrote code for express
- wrote code for express.static
search.js
- wrote code for express
- wrote code for express-json
workspace.js
- wrote code for express
- wrote code for express-json
test_data.js
- wrote code for express
package.json
- added modules to install
- express-json
- mime
- express
- basic-auth
- compression
Things I learned from this project:
- Takes a lot of time to understand this much code. It takes a lot of understanding and debugging to locate the source of problems, even for simple fixes.
- Learned how to use the Chrome Developer tool to debug.
- The importance of communication. There were many cases where I thought my code was working, but it actually wasn't.
- Much stronger understanding of Java Script, Node.js, Express.js.
I get a strange error after I 1) do node install 2) fire up node server.js -c /path/express.conf 3) go to http://localhost:8081/ Error: Can't set headers after they are sent. at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:335:11) at expressInit (/opt/pwebster/openacademy/express.orion.client/modules/orionode/node_modules/express/lib/middleware/init.js:23:42) at Layer.handle [as handle_request] (/opt/pwebster/openacademy/express.orion.client/modules/orionode/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/opt/pwebster/openacademy/express.orion.client/modules/orionode/node_modules/express/lib/router/index.js:312:13) at /opt/pwebster/openacademy/express.orion.client/modules/orionode/node_modules/express/lib/router/index.js:280:7 at Function.process_params (/opt/pwebster/openacademy/express.orion.client/modules/orionode/node_modules/express/lib/router/index.js:330:12) at next (/opt/pwebster/openacademy/express.orion.client/modules/orionode/node_modules/express/lib/router/index.js:271:10) at query (/opt/pwebster/openacademy/express.orion.client/modules/orionode/node_modules/express/lib/middleware/query.js:49:5) at Layer.handle [as handle_request] (/opt/pwebster/openacademy/express.orion.client/modules/orionode/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/opt/pwebster/openacademy/express.orion.client/modules/orionode/node_modules/express/lib/router/index.js:312:13) I'm going to try and push your code in a branch up to the main repo. PW I've pushed it up to pwebster/bug479516 https://git.eclipse.org/c/orion/org.eclipse.orion.client.git/log/?h=pwebster/bug479516 PW Starting from the branch in comment 6, I did some additional work to fix a few bugs and test failures that I found. All unit tests are passing (or in the case of nodegit, failing no worse than they failed before). This has been merged into master. Thanks Kevin! Now that Express is in place, see bug 488342 for additional cleanup work Commits released for this bug
> * af7c0b8 2016-02-23 | Allow tests to run without nodegit
> * 51fa1c7 2016-02-22 | Bug 479516: Fix tests under Express
> * fb795a2 2016-02-23 | Bug 479516: fix maxAge, dotfiles in `orion_static`
> * ab4a5ac 2016-02-23 | Bug 479516: fix JSON and redirect middleware under Express
> * 1243418 2016-02-22 | Bug 479516: Move auth to its own file, catch startup errors
> * 6e19985 2015-11-03 | Bug 479516 - Migrating the Node server from Connect to Express
|