diff --git a/api/package-lock.json b/api/package-lock.json index ec0a4cd..b91e3ef 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -414,6 +414,11 @@ "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", "dev": true }, + "dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" + }, "dynamic-dedupe": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/dynamic-dedupe/-/dynamic-dedupe-0.3.0.tgz", diff --git a/api/package.json b/api/package.json index 26cdab6..f9b79f3 100644 --- a/api/package.json +++ b/api/package.json @@ -15,6 +15,7 @@ "@hapi/joi": "^16.1.8", "bcryptjs": "^2.4.3", "connect-redis": "^4.0.3", + "dotenv": "^10.0.0", "express": "^4.17.1", "express-session": "^1.17.0", "ioredis": "^4.14.1", diff --git a/api/src/config/app.ts b/api/src/config/app.ts index 629b2ca..fde9c8e 100644 --- a/api/src/config/app.ts +++ b/api/src/config/app.ts @@ -1,3 +1,7 @@ +if (process.env.NODE_ENV !== 'production') { + require('dotenv').config(); +} + export const { NODE_ENV = 'development', diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..e2daef5 --- /dev/null +++ b/dockerfile @@ -0,0 +1,8 @@ +#docker file +FROM node:14 +WORKDIR /usr/src/app +COPY ./api/package*.json ./ +RUN npm install +COPY ./api/ . +EXPOSE 8888 +CMD [ "node", "app.js" ] \ No newline at end of file diff --git a/req.http b/req.http new file mode 100644 index 0000000..4ae2eb1 --- /dev/null +++ b/req.http @@ -0,0 +1,14 @@ +### +POST http://localhost:8888/register HTTP/1.1 +content-type: application/json + +{ + "email": "azees.math@gmail.com", + "name": "alex", + "password": "Jdepro123", + "passwordConfirmation": "Jdepro123" +} + +### +GET http://localhost:8888/home HTTP/1.1 +content-type: application/json