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
// Other code removed from example | |
db.sequelize.sync({ | |
force: true, | |
logging: console.log | |
}).then(function() { | |
app.listen(PORT, function() { | |
console.log('Express listening on port ' + PORT + '!'); | |
}); | |
}); |
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
var React = require('react'); | |
var ReactDOM = require('react-dom'); | |
var ReactDOMServer = require('react-dom/server'); | |
var ErrorModal = React.createClass({ | |
getDefaultProps: function () { | |
return { | |
title: 'Error' | |
}; | |
}, |
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
var cachedTodo; | |
db.todo.findById(todoId).then(function(todo){ | |
if (todo) { | |
cachedTodo = todo; | |
return todo.destroy(); | |
} else { | |
res.status(404).send('Unable to delete'); | |
} | |
}).then(function(rows){ |
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
{ | |
"name": "todo-api", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", |
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
console.log('Password Manager started'); | |
var storage = require('node-persist'); | |
var crypto = require('crypto-js'); | |
var argv = require('yargs') | |
.command('create', 'Create a new account', function(yargs){ | |
return yargs.options({ | |
name: { | |
demand: true, | |
alias: 'n', |
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
.app-view { | |
display: flex; | |
max-width: $size-max-content-width; | |
margin: 0 auto; | |
> :first-child { | |
flex-shrink: 0; | |
flex-basis: 5rem; | |
} |
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
var sendEmail = function(email) { | |
var email = { | |
"From": email.From, | |
"To": email.To, | |
"Subject": email.Subject, |
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
export function loginUser(props) { | |
const request = axios.post(`/users/login`, props); | |
return request.then((response) => { | |
var token = response.headers.auth; | |
localStorage.setItem('token', token); //The user's token is taken from the reponse and set in local storage as 'token' | |
console.log('Token: ', localStorage.getItem('token')); | |
}, (response) => { | |
console.log("Error block in loginUser has been reached"); | |
throw new Error(response.status); |
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
var UserTodos = sequelize.define('UserTodos', { | |
favorite: { | |
type: Sequelize.BOOLEAN | |
}, | |
UserId: { | |
type: Sequelize.INTEGER, | |
unique: 'compositeIndex' | |
}, | |
TodoId: { | |
type: Sequelize.INTEGER, |
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
var ShowTodo = React.createClass({ | |
render: function () { | |
console.log('rendering ShowTodo'); | |
return ( | |
<div> | |
<input type="text" onChange={this.textChange}/> | |
</div> | |
) | |
}, |