This commit is contained in:
bahramsa70 2024-06-11 23:26:53 +03:30
parent d471614837
commit c845f1f6c5
5 changed files with 31 additions and 15 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
PORT=4000

View File

@ -2,17 +2,17 @@ import globals from "globals";
import pluginJs from "@eslint/js"; import pluginJs from "@eslint/js";
export default [ export default [
{ files: ["**/*.js"], languageOptions: { sourceType: "commonjs" } }, { files: ["**/*.js"], languageOptions: { sourceType: "commonjs" } },
{ languageOptions: { globals: globals.browser } }, { languageOptions: { globals: { ...globals.browser, ...globals.node } } },
pluginJs.configs.recommended, pluginJs.configs.recommended,
{ {
rules: { rules: {
"prefer-const": "off", "prefer-const": "off",
"quotes": ["warn", "double", { "allowTemplateLiterals": true }], "no-unused-vars": "warn",
"no-unused-vars": "warn", "no-multi-spaces": "warn",
"no-multi-spaces": "warn", "no-case-declarations": "off",
"no-multiple-empty-lines": ["warn", { "max": 1 }], "no-multiple-empty-lines": ["warn", { max: 1 }],
"no-case-declarations": "off" quotes: ["warn", "double", { allowTemplateLiterals: true }],
} },
} },
]; ];

12
package-lock.json generated
View File

@ -9,6 +9,7 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"dotenv": "^16.4.5",
"express": "^4.19.2" "express": "^4.19.2"
}, },
"devDependencies": { "devDependencies": {
@ -601,6 +602,17 @@
"npm": "1.2.8000 || >= 1.4.16" "npm": "1.2.8000 || >= 1.4.16"
} }
}, },
"node_modules/dotenv": {
"version": "16.4.5",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/ee-first": { "node_modules/ee-first": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",

View File

@ -10,6 +10,7 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"dotenv": "^16.4.5",
"express": "^4.19.2" "express": "^4.19.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,9 +1,11 @@
require("dotenv").config();
const express = require("express"); const express = require("express");
const app = express(); const app = express();
const PORT = process.env.PORT
app.use((req, res, next) => { app.use((req, res, next) => {
res.send("Hello"); res.send("Hello");
}); });
app.listen(3000); app.listen(PORT);