Skip to content
Snippets Groups Projects
Commit ef32277a authored by Bodor Máté's avatar Bodor Máté
Browse files

Install and config dotenv

parent 89a2be6c
No related branches found
No related tags found
2 merge requests!4Feature/authsch integration,!1Feature/dotenv
AUTH_SECRET_KEY=
AUTH_ID=
\ No newline at end of file
......@@ -2007,6 +2007,11 @@
"is-obj": "^1.0.0"
}
},
"dotenv": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
},
"duplexer3": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
......
......@@ -25,6 +25,7 @@
},
"dependencies": {
"body-parser": "^1.19.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mongoose": "^5.9.1",
"simple-oauth2": "^3.3.0"
......
import "./utils/env"
import express, { Request, Response, NextFunction, Application } from "express";
import bodyParser from "body-parser";
......@@ -8,6 +9,9 @@ app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x
app.get("/", (req: Request, res: Response) => res.send("Hel World!"));
// Register routes
app.use((err: any, req: Request, res: Response, next: NextFunction) => {
res.status(500).send("Houston, we have a problem!");
......@@ -15,4 +19,4 @@ app.use((err: any, req: Request, res: Response, next: NextFunction) => {
console.error(err.stack);
});
app.listen(3000, () => console.log(`Example app listening on port 8000!`));
app.listen(8000, () => console.log(`Example app listening on port 8000!`));
import { resolve } from "path"
import { config } from "dotenv"
config({ path: resolve(__dirname, "../../.env") })
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment