This file contains 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
// Import the core angular services. | |
import { Component } from "@angular/core"; | |
import { Event as NavigationEvent } from "@angular/router"; | |
import { filter } from "rxjs/operators"; | |
import { NavigationStart } from "@angular/router"; | |
import { Router } from "@angular/router"; | |
// ----------------------------------------------------------------------------------- // | |
// ----------------------------------------------------------------------------------- // | |
This file contains 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 url = require('url'); | |
const router = require('express').Router(); | |
const passport = require('passport'); | |
const jwt = require('jsonwebtoken'); | |
const User = require('../schemas/user'); | |
router.post('/register', (req, res) => { | |
if(!(req.body.email && req.body.password)) return res.status(200).send('no password or email provided'); | |
User.findByEmail(req.body.email, (err, user) => { | |
if(user.length > 0) return res.status(200).send('user with given email exists'); |