Skip to content

Commit

Permalink
code from livestream faraday-academy#8 as well as color variables in …
Browse files Browse the repository at this point in the history
…Sass and removed mock data from front-end
  • Loading branch information
gwenf committed Jan 2, 2020
1 parent 4c2cbc0 commit 72b99a9
Show file tree
Hide file tree
Showing 14 changed files with 272 additions and 51 deletions.
4 changes: 1 addition & 3 deletions curriculum-back/db/Curriculum.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const mongoose = require('mongoose')
var timestamps = require('mongoose-timestamp')

const CurriculumSchema = new mongoose.Schema({
name: {
Expand All @@ -20,9 +19,8 @@ const CurriculumSchema = new mongoose.Schema({
resources: [String],
projects: [String]
}]
})
}, { timestamps: true })

CurriculumSchema.plugin(timestamps);
const Curriculum = mongoose.model('Curriculum', CurriculumSchema)

module.exports = Curriculum
149 changes: 149 additions & 0 deletions curriculum-back/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions curriculum-back/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"author": "Gwendolyn Faraday <[email protected]> (https://gwenfaraday.com/)",
"license": "MIT",
"dependencies": {
"cors": "2.8.5",
"express": "4.17.1",
"helmet": "3.21.2",
"module-alias": "2.2.2",
"mongoose": "5.8.3",
"mongoose-timestamp": "0.6.0",
Expand Down
15 changes: 9 additions & 6 deletions curriculum-back/server/api/curricula.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ router.route('/')
})

router.route('/:id')
.get(function (req, res) {
res.send(req.params)
.get(async function (req, res) {
const curriculum = await Curriculum.findById(req.params.id)
res.send(curriculum)
})
.patch(function (req, res) {
res.send('Got a POST request')
.patch(async function (req, res) {
await Curriculum.updateOne({ _id: req.params.id }, { ...req.body })
res.send('Success')
})
.delete(function (req, res) {
res.send('Got a DELETE request')
.delete(async function (req, res) {
await Curriculum.deleteOne({ _id: req.params.id })
res.send('Success')
})

module.exports = router
4 changes: 4 additions & 0 deletions curriculum-back/server/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const express = require('express')
const helmet = require('helmet')
var cors = require('cors')

const routes = require('./api')
require('../db')
Expand All @@ -8,6 +10,8 @@ const port = 5000

// middleware
app.use(express.json())
app.use(helmet())
app.use(cors())

app.use('/api/v1', routes)

Expand Down
37 changes: 37 additions & 0 deletions curriculum-front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions curriculum-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"test:e2e": "vue-cli-service test:e2e"
},
"dependencies": {
"axios": "0.19.0",
"core-js": "^2.6.5",
"register-service-worker": "^1.6.2",
"vue": "^2.6.10",
Expand Down
10 changes: 0 additions & 10 deletions curriculum-front/src/data/curricula.js

This file was deleted.

Loading

0 comments on commit 72b99a9

Please sign in to comment.