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

ES6 and Let's Encrpyt #14

Closed
wants to merge 5 commits into from
Closed

ES6 and Let's Encrpyt #14

wants to merge 5 commits into from

Conversation

Akxe
Copy link
Contributor

@Akxe Akxe commented Aug 10, 2017

Solves #11, #12 and #13

  • Move to promises
  • Move to ES6 writing style
  • Variable hoisting (let, const)
  • Micro optimisations
  • Moving from certBot to Let's Encrypt
  • Make Router constructor configurable instead of file
  • Export Router to world

Most of your code is commented for references, but parts that I knew how to rewrite is rewrited. All parts that are to be done are commented with TODO and what should be done. If you could help me out with the part, that is left, I would be very much pleased. I failed.

Now solves only #12, and partialy solves #11 and #13

Move to ES6 and starting on windows friendly let's encrypt
Added most comments to functions.
Added send file to `doErrorResponse`
Added missing coma
Added check to not generate SSL for disabled routes
@Akxe
Copy link
Contributor Author

Akxe commented Aug 13, 2017

@Irrelon could you please review changes?

Fixed all parts, that made server crash
Started implementing Let's encrypt (greenlock)
Updated package.json to include necessary things to run server and removed postinstall
@Irrelon
Copy link
Owner

Irrelon commented Aug 30, 2017

@Akxe Looks ok so far, cannot merge this if it doesn't work yet though. Other comments are inline in the code.

package.json Outdated
@@ -1,7 +1,19 @@
{
"name": "node-irrelon-router",
"version": "0.1.0",
"name": "node-akxe-router",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not change the name of the project unless you want to deploy this yourself to NPM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry my bad

package.json Outdated
"name": "node-irrelon-router",
"version": "0.1.0",
"name": "node-akxe-router",
"version": "0.0.1",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not reverse the version numbers unless you are starting a complete fork that will never get merged back in.

package.json Outdated
"ssl-config": "^0.0.9"
},
"scripts": {
"start": "forever start -a --uid \"akxe-router\" router.js",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name change here as well.

package.json Outdated
"scripts": {
"start": "forever start -a --uid \"akxe-router\" router.js",
"test": "node router.js",
"stop": "forever stop akxe-router"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name change here as well.

router.js Outdated
const fsAccess = require('fs-access')
const mkdirp = require('mkdirp')
const configFilePath = __dirname + '/config.json'*/

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this stuff is no longer needed, remove the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed a lot and probably missed that part my bad

router.js Outdated
const mkdirp = require('mkdirp')
const configFilePath = __dirname + '/config.json'*/

const greenLock = require('greenlock')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semicolons have been pulled from the code completely. Semicolons remove ambiguity in code and should be in there. Seen too many errors in code caused by not adding them in the past from developers who are not as familiar with the code as you or I might be.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically the IDE warns about semicolons missing.

routesFile: './exampleConfig.json'
})
router.listen()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that given this is a complete re-write, some tests should be made to ensure this works. Including websocket tests as well as we are supposed to support them too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely agreed, however I am unable to resolve implementation issues with greenlock, thus it is not working with SSL. And second problem is that I don't know how to create tests, if you create one, I can copycat the others.

@Akxe Akxe closed this Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants