Skip to content

Instantly share code, notes, and snippets.

View patDevNG's full-sized avatar

Okuns Patrick patDevNG

  • Stockholm
View GitHub Profile
@patDevNG
patDevNG / app.js
Created May 2, 2019 16:50 — forked from stongo/app.js
Joi validation in a Mongoose model
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;
db.on('error', function() {
return console.error.bind(console, 'connection error: ');
});
let React = require('react');
const App = props => <div id="app"><Notification {...props.notification}/></div>
let map = { success: 'success', message: 'info', caution: 'warning', error: 'danger' }
class Notification extends React.Component {
render() {
let props = this.props;
let type = map[props.type] || 'info';