Skip to content
Discussion options

You must be logged in to vote

Hi @dalisoft

dotenv-safe uses dotenv than all values return as {String} type

This library requires that the "port" parameter be specified as {Number} type

View rows 129,131

You can use {Number} and for your variables ... it's what I do:

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)
    }
})

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #168 on December 09, 2020 12:15.