Skip to content

Commit

Permalink
Merge branch 'development' into Tim_add_materials_list_routing
Browse files Browse the repository at this point in the history
  • Loading branch information
tdkent committed Oct 11, 2023
2 parents 61663e9 + dc6c34e commit 0038eae
Show file tree
Hide file tree
Showing 14 changed files with 431 additions and 221 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": ["eslint:recommended", "airbnb-base"],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ JWT_SECRET=<secret value>

To make the process easy create a .env file and put the above text in the file and replace values with the correct values, which you can get from your teammates. Then do an npm run-script build followed by an npm start. By default, the services will start on port 4500 and you can http://localhost:4500/api/<routename> to access the methods. A tools like Postman will be your best friend here, you will need to have an auth token placed in the 'Authorization' header which you can get through the networking tab of the local frontend when you login.

* `npm run lint` command for fixing lint
* `npm run build` command for building server
* `npm run buildw` command for auto rebuild upon change of src
* `npm run start` command for running the server in dist
* `npm run serve` command for running server in src without build
* `npm run lint` -- fix lint
* `npm run build` -- build src server and save in dist
* `npm run buildw` -- auto rebuild upon change of src
* `npm run start` -- run the server in dist
* `npm run serve` -- run the server in src without build
* `npm run dev` -- run the server in src and auto restart upon change of src

Note: Once you check in the code in github, the application will be publsihed to the following:
Developement : https://hgn-rest-dev.herokuapp.com
Expand Down
160 changes: 131 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build": "babel src -d dist",
"buildw": "babel src -d dist --watch",
"start": "node dist/server.js",
"serve": "node src/server.js"
"dev": "nodemon --exec babel-node src/server.js",
"serve": "babel-node src/server.js"
},
"pre-commit": [
"lint"
Expand All @@ -23,7 +24,6 @@
"@babel/eslint-parser": "^7.15.0",
"@types/express": "^4.17.6",
"@types/node": "^8.10.61",
"babel-eslint": "^10.1.0",
"eslint": "^8.47.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^13.1.0",
Expand All @@ -33,6 +33,7 @@
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-react-hooks": "^4.6.0",
"lint-staged": "^13.0.3",
"nodemon": "^3.0.1",
"pre-commit": "^1.2.2"
},
"dependencies": {
Expand Down Expand Up @@ -66,5 +67,10 @@
"redis": "^4.2.0",
"uuid": "^3.4.0",
"ws": "^8.8.1"
},
"nodemonConfig": {
"watch": [
"/src/**/*"
]
}
}
25 changes: 25 additions & 0 deletions src/controllers/isEmailExistsController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const UserProfile = require('../models/userProfile');

const isEmailExistsController = function () {

const isEmailExists = async function (req, res) {

try {
const userProfile = await UserProfile.findOne({ email: req.params.email }).lean().exec()

if (userProfile) {
res.status(200).send(`Email, ${userProfile.email}, found.`)
} else {
res.status(403).send(`Email, ${req.params.email}, not found.`)
}
} catch (err) {
console.log(err)
}
}

return {
isEmailExists
}
}

module.exports = isEmailExistsController
Loading

0 comments on commit 0038eae

Please sign in to comment.