Skip to content

Update for ES6 Syntax#84

Merged
thehabes merged 8 commits into
mainfrom
65-ES6-refactor
May 21, 2024
Merged

Update for ES6 Syntax#84
thehabes merged 8 commits into
mainfrom
65-ES6-refactor

Conversation

@thehabes

@thehabes thehabes commented May 20, 2024

Copy link
Copy Markdown
Member

Tested each endpoint through talend api.

Tested all interactions through the interface.

Tested against an expired access token.

@thehabes thehabes marked this pull request as ready for review May 20, 2024 19:46
This was linked to issues May 20, 2024
@thehabes thehabes self-assigned this May 20, 2024
@thehabes thehabes requested a review from cubap May 20, 2024 19:50

@cubap cubap left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can make these changes tomorrow but I feel like you were intentionally triggering me.
Looks great otherwise.

Comment thread CODEOWNERS
@@ -0,0 +1 @@
* @thehabes @cubap

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sneaky

Comment thread app.js Outdated
import deleteRouter from "./routes/delete.js"
import overwriteRouter from "./routes/overwrite.js"
import cors from "cors"
import {updateExipredToken} from "./tokens.js"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nope. typo!

Comment thread app.js Outdated

require('./tokens.js')
// Check for and update token on app start
updateExipredToken()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh, never mind, now it's a movement.

Comment thread bin/testApp.js Outdated
*/

var port = normalizePort('3333')
let port = normalizePort('3333')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

const

Comment thread bin/testApp.js Outdated
}

var bind = typeof port === 'string'
let bind = typeof port === 'string'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

const

Comment thread sample.env
RERUM_API_ADDR = https://store.rerum.io/v1/api/
RERUM_ID_PATTERN = https://store.rerum.io/v1/id/
RERUM_ACCESS_TOKEN_URL = http://store.rerum.io/client/request-new-access-token
RERUM_REGISTRATION_URL = https://devstore.rerum.io/v1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would make the case that this could be left as "store" because it is a sample for production. At least the access tokens, since it is shared twixt the two may be left as "store".

Comment thread tokens.js
@@ -1,5 +1,8 @@
const fs = require('node:fs/promises')
const { parse, stringify } = require('envfile')
import dotenv from "dotenv"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this really needed? When is this called without one of the ./bins?

Comment thread tokens.js Outdated
import { parse, stringify } from "envfile"

const sourcePath = '.env'
let expired = true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So... this is never used.

Comment thread tokens.js Outdated
if (isTokenExpired(process.env.ACCESS_TOKEN)) {
console.log("Tiny Node detected an expired access token. Updating the token now.")
generateNewAccessToken()
function updateExipredToken() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is misspelled everywhere and I hate it.

Comment thread tokens.js Outdated
}
}

export {updateExipredToken}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

export {updateExipredToken as updeatExipredTkoen}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

also env_file_obj should be const but I cannot target that line.

@thehabes thehabes requested a review from cubap May 21, 2024 15:32
@thehabes thehabes merged commit faa0da2 into main May 21, 2024
@thehabes thehabes deleted the 65-ES6-refactor branch May 21, 2024 15:44
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.

CODEOWNERS URL error for new token Replace CJS with ES6 modules

2 participants