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
package com.awews; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; | |
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; | |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | |
import com.awews.person.User; |
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
require("dotenv").config() | |
var express = require('express'), | |
app = express(), | |
// cors = require('cors'), | |
bodyParser = require('body-parser'); | |
const request = require('request'); | |
// app.use(cors()); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ extended: true })); |
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
async handleLoadPalabras() { | |
let fourLetterWords = await apiCalls.getPalabras('four-letter-words'); | |
let prefixSuffixRoots = await apiCalls.getPalabras('prefix-suffix-roots'); | |
let verbos = await apiCalls.getPalabras('verbos'); | |
this.setState({ | |
fourLetterWords, | |
prefixSuffixRoots, | |
verbos | |
}); |
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
'use strict' | |
const express = require('express') | |
const bodyParser = require('body-parser') | |
const request = require('request'); | |
const app = express().use(bodyParser.json()); | |
let db = require("./models"); | |
let challengerRoutes = require("./routes/challengers"); | |
let attachmentRoutes = require("./routes/attachments"); |
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 React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
class DetailsPalabras extends Component { | |
constructor(props) { | |
super(props); | |
const { fourLetterWord, prefixSuffixRoot, verbo } = props.data; | |
// load next random word | |
const { p } = props.location.hash; | |
const { onLoadRandomPalabra } = props.data; |
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
{ | |
"error": { | |
"message": "No authorization token was found" | |
} | |
} |
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
async handleLoadPalabra(p, pObj){ | |
let palabra; | |
let params = p.slice(0, -1); | |
console.log(p, pObj); | |
if (pObj.hasOwnProperty("_id")) { | |
console.log(pObj); | |
palabra = await apiCalls.getPalabra(p, pObj); | |
console.log(palabra); | |
} else if (pObj.hasOwnProperty('word')) { | |
let word = pObj.word; |
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
export async function updatePalabra(p, pObj) { | |
console.log(`${APIURL}${p}${pObj._id}`); | |
console.log(pObj); | |
let token = `Bearer ${pObj.token}`; | |
console.log(token); | |
return fetch(`${APIURL}${p}${pObj._id}`, { | |
method: 'put', | |
headers: new Headers({ | |
'Content-Type': 'application/json', | |
'Authorization': token |
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
require('dotenv').load() | |
var jwt = require("jsonwebtoken") | |
exports.loginRequired = function (req, res, next) { | |
try { | |
var token = req.headers.authorization.split(" ")[1] | |
jwt.verify(token, process.env.SECRET_KEY, function (err, decoded) { | |
if (decoded) { | |
next(); | |
} else { |
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
require("dotenv").config() | |
var express = require('express'), | |
app = express(), | |
cors = require('cors'), | |
bodyParser = require('body-parser'); | |
authRoutes = require("./routes/auth"); | |
var db = require("./models"); | |
var authRoutes = require('./routes/auth'); | |
var gameRoutes = require('./routes/games'); |