This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<title>Hello Heady</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<meta charset="UTF-8" /> | |
<script> | |
/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"_id":{"$oid":"5ce1b1c813940177b4fd5e40"},"isActive":true,"isParent":true,"ancestors":[],"childCategories":[{"$oid":"5ce1b26a13940177b4fd5e41"},{"$oid":"5ce1b2b913940177b4fd5e42"}],"name":"appliances","displayName":"Appliances","createdAt":{"$date":{"$numberLong":"1558294984151"}},"updatedAt":{"$date":{"$numberLong":"1558295225887"}},"__v":{"$numberInt":"0"}} | |
{"_id":{"$oid":"5ce1b26a13940177b4fd5e41"},"isActive":true,"isParent":false,"ancestors":[{"$oid":"5ce1b1c813940177b4fd5e40"}],"childCategories":[],"name":"geyser","displayName":"Geyser","parentCategory":{"$oid":"5ce1b1c813940177b4fd5e40"},"createdAt":{"$date":{"$numberLong":"1558295146233"}},"updatedAt":{"$date":{"$numberLong":"1558295146233"}},"__v":{"$numberInt":"0"}} | |
{"_id":{"$oid":"5ce1b2b913940177b4fd5e42"},"isActive":true,"isParent":false,"ancestors":[{"$oid":"5ce1b1c813940177b4fd5e40"}],"childCategories":[{"$oid":"5ce1b2c913940177b4fd5e43"},{"$oid":"5ce1b2d113940177b4fd5e44"}],"name":"air conditioner","displayName":"Air Conditioner","parentCatego |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"_id":{"$oid":"5ce1b35d13940177b4fd5e48"},"isActive":true,"categories":[{"$oid":"5ce1b2d113940177b4fd5e44"}],"name":"voltas window ac","displayName":"Voltas Window AC","createdAt":{"$date":{"$numberLong":"1558295389139"}},"updatedAt":{"$date":{"$numberLong":"1558295389139"}},"__v":{"$numberInt":"0"}} | |
{"_id":{"$oid":"5ce1b39713940177b4fd5e49"},"isActive":true,"categories":[{"$oid":"5ce1b2ff13940177b4fd5e46"}],"name":"nike sport shoes","displayName":"Nike Sport Shoes","createdAt":{"$date":{"$numberLong":"1558295447576"}},"updatedAt":{"$date":{"$numberLong":"1558295447576"}},"__v":{"$numberInt":"0"}} | |
{"_id":{"$oid":"5ce1b3a013940177b4fd5e4a"},"isActive":true,"categories":[{"$oid":"5ce1b2ff13940177b4fd5e46"}],"name":"adidas sport shoes","displayName":"Adidas Sport Shoes","createdAt":{"$date":{"$numberLong":"1558295456560"}},"updatedAt":{"$date":{"$numberLong":"1558295456560"}},"__v":{"$numberInt":"0"}} | |
{"_id":{"$oid":"5ce1b3b913940177b4fd5e4b"},"isActive":true,"categories":[{"$oid":"5ce1b31013940177b4fd5e47"}]," |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
.vscode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:10-alpine | |
WORKDIR /usr/src/app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . | |
ENV APP_SETTINGS_FILE_PATH '/usr/src/app/config/appSettings.json' | |
EXPOSE 9000 | |
CMD ["node", "app.js"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { validatePostLogin, validatePostSignup } = require('../validations/auth'); | |
const { postLogin, postSignup } = require('../controllers/authController'); | |
module.exports = async (fastify) => { | |
fastify.post('/auth/login', validatePostLogin, postLogin); | |
fastify.post('/auth/signup', validatePostSignup, postSignup); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nconf = require('nconf'); | |
const userPasswordRegex = nconf.get('userPasswordRegex'); | |
const validatePostLogin = { | |
schema: { | |
body: { | |
type: 'object', | |
properties: { | |
email: { type: 'string', format: 'email' }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nconf = require('nconf'); | |
const User = require('../models/User'); | |
const { SignUpResponse } = require('../models/Auth'); | |
const { INVALID_PASSWORD, USER_DOESNT_EXISTS, USER_EXISTS } = require('../models/Errors'); | |
const postSignup = async (req, res) => { | |
const { email, password } = req.body; | |
try { | |
const existingUser = await User.findOne({ email: req.body.email }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bcrypt = require('bcrypt-nodejs'); | |
const mongoose = require('mongoose'); | |
const userSchema = new mongoose.Schema({ | |
email: { | |
type: String, | |
required: true, | |
unique: true, | |
}, | |
password: String, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nconf = require('nconf'); | |
const server = require('./server') | |
const { connectMongo } = require('./api/db/db') | |
const { loadSettings } = require('./config/configurationAdaptor') | |
const appSettingsPath = process.env.APP_SETTINGS_FILE_PATH; | |
loadSettings({ appSettingsPath }) | |
.then(() => { | |
const mongoURI = nconf.get('db.mongodb.uri'); |
NewerOlder