From 8468fe235ad39034f687f5f75c7b497519b2c979 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Sat, 16 May 2020 14:59:10 +0200 Subject: [PATCH] + Started POST route for spells (w/ validation) and applied changes --- index.js | 7 +++++-- routes/index.js | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 90d9a12..9780040 100644 --- a/index.js +++ b/index.js @@ -2,8 +2,9 @@ // MODULES const express = require('express') +const bodyParser = require('body-parser') const helmet = require('helmet') -const morgan = require('morgan'); +const morgan = require('morgan') const cors = require('cors') // module to format the json response // Creates instances of database connections @@ -18,8 +19,9 @@ const routes = require('./routes') // Builds app w/ express let app = express() +app.use(bodyParser.json()) app.use(cors()) -app.use(morgan('combined')) +app.use(morgan('tiny')) app.use(helmet()) // Serves @@ -27,3 +29,4 @@ const server = app.listen( port, () => {console.log(`App listening on port ${por // Routing app.use('/api/spells', routes.spells) +app.use('/api/schools', routes.schools) \ No newline at end of file diff --git a/routes/index.js b/routes/index.js index 5bfe085..dcef834 100644 --- a/routes/index.js +++ b/routes/index.js @@ -1,5 +1,7 @@ -const spells = require('./spells'); +const spells = require('./spells') +const schools = require('./schools') module.exports = { spells, + schools, } \ No newline at end of file