Skip to content

Instantly share code, notes, and snippets.

View nguyentrithuc's full-sized avatar

Thuc T. Nguyen nguyentrithuc

View GitHub Profile
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, url_for, redirect, request
from flask_pymongo import PyMongo
from flask_restful import Api, Resource
app = Flask(__name__)
app.config["MONGO_DBNAME"] = "students_db"
mongo = PyMongo(app, config_prefix='MONGO')
APP_URL = "http://127.0.0.1:5000"
import React, {Component} from 'react';
import axios from 'axios';
export default class Search extends Component {
constructor(){
super();
this.state = {
list: [],
filteredList: [],
router.post('/signin', function(req, res) {
User.findOne({
username: req.body.username
}, function(err, user) {
if (err) throw err;
if (!user) {
res.status(401).send({success: false, msg: 'Authentication failed. User not found.'});
} else {
// check if password matches