diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..f2f19c4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,12 @@ +# Contributing + +- Fork this repository +- Take a ticket from the Ready section of the project page. (Some tickets in the Backlog may be ready for work, but are probably dependent on items in the Ready section - please check with maintainer if you're interested in Backlog work.) +- Create a topic branch. Branch names should begin with the issue number, followed by text describing the work. Please use lower-kebab-case (i.e. 2-readme-updated). +- Complete work +- Submit a pull request +- Necessary migrations have been created with the following commands: + - migration:create [ name of migration ] + - migration:up + - migration:down [ name of migration ] + diff --git a/README.md b/README.md index 2fbf185..1f4eedb 100644 --- a/README.md +++ b/README.md @@ -31,4 +31,4 @@ A mongodb database named lizardboard must be created prior to starting the appli - [React](https://facebook.github.io/react/) ## Testing -TBD \ No newline at end of file +TBD diff --git a/database.js b/database.js new file mode 100644 index 0000000..4988dd7 --- /dev/null +++ b/database.js @@ -0,0 +1,11 @@ +const DATABSE_URL = 'mongodb://127.0.0.1:27017/lizardboard'; +const MongoClient = require('mongodb').MongoClient, assert = require('assert'); + +MongoClient.connect(DATABASE_URL, (err, response) => { + .then( DATABASE_URL => { + response.send('Successfully connected to the database') + }) + .catch( error => { + response.render('error', { error: error }) + }); +}); diff --git a/migrations/1477959880038-add-users.js b/migrations/1477959880038-add-users.js new file mode 100644 index 0000000..307a41c --- /dev/null +++ b/migrations/1477959880038-add-users.js @@ -0,0 +1,25 @@ +'use strict'; +const mongoose = require('mongoose'); + +/** + * Make any changes you need to make to the database here + */ + +exports.up = function up (done) { + const add_users = new mongoose.Schema({ + _id: {seq: 0}, + name: { + first: String, + last: { type: String, trim: true } + }, + email: {String} + }); + done(); +}; + +/** + * Make any changes that UNDO the up function side effects here (if possible) + */ +exports.down = function down(done) { + done(); +}; diff --git a/package.json b/package.json index 40fe0d1..aa68a90 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,10 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "nodemon ./bin/www" + "start": "nodemon ./bin/www", + "migration:create": "node_modules/.bin/migrate -d mongodb://localhost:27017/lizardboard create", + "migration:up": "node_modules/.bin/migrate -d mongodb://localhost:27017/lizardboard up", + "migration:down": "node_modules/.bin/migrate -d mongodb://localhost:27017/lizardboard down" }, "repository": { "type": "git", @@ -23,7 +26,9 @@ "debug": "~2.2.0", "ejs": "^2.5.2", "express": "~4.13.4", + "migrate-mongoose": "^2.0.2", "mongoose": "^4.6.5", + "mocha": "^3.1.2", "morgan": "~1.7.0", "pug": "^2.0.0-beta6", "react": "^15.3.2", @@ -31,12 +36,10 @@ "react-router": "^2.6.1" }, "devDependencies": { - "mocha": "^3.1.2", "babel-cli": "^6.11.4", "babel-core": "^6.13.2", "babel-preset-es2015": "^6.13.2", "babel-preset-react": "^6.11.1", - "mocha": "^3.1.2", "nodemon": "^1.11.0", "serve-favicon": "~2.3.0" } diff --git a/server/index.js b/server/index.js index 3d4d5c1..b7069b0 100644 --- a/server/index.js +++ b/server/index.js @@ -69,5 +69,4 @@ app.use(function(err, req, res, next) { }); }); - -module.exports = app; \ No newline at end of file +module.exports = app; diff --git a/views/index.pug b/views/index.pug index 2202a2e..f0799fc 100644 --- a/views/index.pug +++ b/views/index.pug @@ -6,4 +6,3 @@ block content #root script(src="/public/javascripts/index.js") - diff --git a/views/layout.pug b/views/layout.pug index a586957..373bd42 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -7,4 +7,3 @@ html body block content script(src="/javascripts/index.js") -