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 |
Answered by
subversivo58
Jun 24, 2019
Replies: 4 comments
|
You are not following documented API |
0 replies
|
This is snippet only, all of your examples doesn't work when using |
0 replies
|
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)
}
}) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @dalisoft
dotenv-safeusesdotenvthan 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: