+ Started POST route for spells (w/ validation) and applied changes
This commit is contained in:
7
index.js
7
index.js
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
// MODULES
|
// MODULES
|
||||||
const express = require('express')
|
const express = require('express')
|
||||||
|
const bodyParser = require('body-parser')
|
||||||
const helmet = require('helmet')
|
const helmet = require('helmet')
|
||||||
const morgan = require('morgan');
|
const morgan = require('morgan')
|
||||||
const cors = require('cors') // module to format the json response
|
const cors = require('cors') // module to format the json response
|
||||||
|
|
||||||
// Creates instances of database connections
|
// Creates instances of database connections
|
||||||
@@ -18,8 +19,9 @@ const routes = require('./routes')
|
|||||||
|
|
||||||
// Builds app w/ express
|
// Builds app w/ express
|
||||||
let app = express()
|
let app = express()
|
||||||
|
app.use(bodyParser.json())
|
||||||
app.use(cors())
|
app.use(cors())
|
||||||
app.use(morgan('combined'))
|
app.use(morgan('tiny'))
|
||||||
app.use(helmet())
|
app.use(helmet())
|
||||||
|
|
||||||
// Serves
|
// Serves
|
||||||
@@ -27,3 +29,4 @@ const server = app.listen( port, () => {console.log(`App listening on port ${por
|
|||||||
|
|
||||||
// Routing
|
// Routing
|
||||||
app.use('/api/spells', routes.spells)
|
app.use('/api/spells', routes.spells)
|
||||||
|
app.use('/api/schools', routes.schools)
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
const spells = require('./spells');
|
const spells = require('./spells')
|
||||||
|
const schools = require('./schools')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
spells,
|
spells,
|
||||||
|
schools,
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user