Conflict with dotenv-safe
?
#168
-
Hi @alexhultman I catched one issue unexpectedly. This library conflicts with // import envSafe from 'dotenv-safe';
import uWS from 'uWebSockets.js';
const app = uWS.App();
// envSafe.config();
app.listen(3000); This code runs, when remove comments part and use |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
You are not following documented API |
Beta Was this translation helpful? Give feedback.
-
This is snippet only, all of your examples doesn't work when using |
Beta Was this translation helpful? Give feedback.
-
Hi @dalisoft
This library requires that the "port" parameter be specified as View rows 129,131 You can use require('dotenv').config()
const uWS = require('uWebSockets.js')
// Listen server requiries `{Number}` type for "port" parameter of server
const PORT = Number(process.env.PORT) || 3000
const app = uWS.App()
// HTTP routes
app.any('/*', (res, req) => {})
// Server listen
app.listen(PORT, token => {
if ( token ) {
console.log('Runing on port: ' + PORT)
} else {
console.log('Failed to listen to port ' + PORT)
}
}) |
Beta Was this translation helpful? Give feedback.
-
Thanks @subversivo58 |
Beta Was this translation helpful? Give feedback.
Hi @dalisoft
dotenv-safe
usesdotenv
than all values return as{String}
typeThis library requires that the "port" parameter be specified as
{Number}
typeView rows 129,131
You can use
{Number}
and for your variables ... it's what I do: