Update for ES6 Syntax#84
Conversation
cubap
left a comment
There was a problem hiding this comment.
I can make these changes tomorrow but I feel like you were intentionally triggering me.
Looks great otherwise.
| @@ -0,0 +1 @@ | |||
| * @thehabes @cubap | |||
| import deleteRouter from "./routes/delete.js" | ||
| import overwriteRouter from "./routes/overwrite.js" | ||
| import cors from "cors" | ||
| import {updateExipredToken} from "./tokens.js" |
|
|
||
| require('./tokens.js') | ||
| // Check for and update token on app start | ||
| updateExipredToken() |
There was a problem hiding this comment.
oh, never mind, now it's a movement.
| */ | ||
|
|
||
| var port = normalizePort('3333') | ||
| let port = normalizePort('3333') |
| } | ||
|
|
||
| var bind = typeof port === 'string' | ||
| let bind = typeof port === 'string' |
| 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 |
There was a problem hiding this comment.
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".
| @@ -1,5 +1,8 @@ | |||
| const fs = require('node:fs/promises') | |||
| const { parse, stringify } = require('envfile') | |||
| import dotenv from "dotenv" | |||
There was a problem hiding this comment.
Is this really needed? When is this called without one of the ./bins?
| import { parse, stringify } from "envfile" | ||
|
|
||
| const sourcePath = '.env' | ||
| let expired = true |
| if (isTokenExpired(process.env.ACCESS_TOKEN)) { | ||
| console.log("Tiny Node detected an expired access token. Updating the token now.") | ||
| generateNewAccessToken() | ||
| function updateExipredToken() { |
There was a problem hiding this comment.
This is misspelled everywhere and I hate it.
| } | ||
| } | ||
|
|
||
| export {updateExipredToken} |
There was a problem hiding this comment.
export {updateExipredToken as updeatExipredTkoen}
There was a problem hiding this comment.
also env_file_obj should be const but I cannot target that line.
Tested each endpoint through talend api.
Tested all interactions through the interface.
Tested against an expired access token.