use of dotenv to get url and port.
This commit is contained in:
parent
5dede3767b
commit
21e059fd33
5 changed files with 8 additions and 4 deletions
2
.env.example
Normal file
2
.env.example
Normal file
|
@ -0,0 +1,2 @@
|
|||
URL="http://localhost"
|
||||
SERVER_PORT="3030"
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
node_modules/
|
||||
package-lock.json
|
||||
.env
|
|
@ -9,7 +9,7 @@
|
|||
"author": "unurled",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"dotenv": "^14.3.0",
|
||||
"dotenv": "^14.3.2",
|
||||
"express": "^4.17.2",
|
||||
"express-session": "^1.17.2",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require('dotenv').config()
|
||||
var express = require('express');
|
||||
var session = require('express-session');
|
||||
var bodyParser = require('body-parser');
|
||||
|
@ -46,4 +47,4 @@ app.get('/edit', function(request, res) {
|
|||
}
|
||||
});
|
||||
|
||||
app.listen(3000, console.log("http://localhost:3000"))
|
||||
app.listen(process.env.SERVER_PORT, console.log(process.env.URL + '/' + process.env.SERVER_PORT))
|
|
@ -10,6 +10,6 @@ function buildHeaders(authorization = null) {
|
|||
return headers;
|
||||
}
|
||||
|
||||
const response = await fetchService.performGetHttpRequest('http://localhost:3000/text', buildHeaders());
|
||||
const response = await fetchService.performGetHttpRequest(window.location.href + 'text', buildHeaders());
|
||||
|
||||
document.getElementById("text").innerHTML = response.text;
|
||||
|
|
Loading…
Reference in a new issue