diff --git a/client/api/api.js b/client/api/api.js new file mode 100644 index 0000000..5524972 --- /dev/null +++ b/client/api/api.js @@ -0,0 +1,7 @@ +import axios from "axios" + +const url = "http://localhost:2814/api" + +export default axios.create({ + baseURL: url +}) \ No newline at end of file diff --git a/client/api/repositories.js b/client/api/repositories.js new file mode 100644 index 0000000..cd4abd1 --- /dev/null +++ b/client/api/repositories.js @@ -0,0 +1,11 @@ +import spellsRepository from './spellsRepository' + +// List of possible repositories +const repositories = { + spells: spellsRepository +} + +// Usage : RepositoryFactoryInstance.get('reponame'); +export const RepositoryFactory = { + get: name => repositories[name] +} \ No newline at end of file diff --git a/client/api/spellsRepository.js b/client/api/spellsRepository.js new file mode 100644 index 0000000..5b60082 --- /dev/null +++ b/client/api/spellsRepository.js @@ -0,0 +1,14 @@ +import api from './api' + +// URL for spells +const resource = "/spells" + +// CRUD methods for spells +export default { + getSpells() { + return api.get(`${resource}`) + }, + getSpell(id) { + return api.get(`${resource}?id=${id}`) + }, +} \ No newline at end of file diff --git a/client/src/assets/images/logo-dark.svg b/client/src/assets/images/logo-dark.svg new file mode 100644 index 0000000..c6b7b67 --- /dev/null +++ b/client/src/assets/images/logo-dark.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/client/src/assets/images/logo-light.svg b/client/src/assets/images/logo-light.svg new file mode 100644 index 0000000..6d54351 --- /dev/null +++ b/client/src/assets/images/logo-light.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/client/src/assets/images/logo.png b/client/src/assets/images/logo.png deleted file mode 100644 index f3d2503..0000000 Binary files a/client/src/assets/images/logo.png and /dev/null differ diff --git a/client/src/components/spells/spell-card.vue b/client/src/components/spells/spell-card.vue index ab4347e..6cda65d 100644 --- a/client/src/components/spells/spell-card.vue +++ b/client/src/components/spells/spell-card.vue @@ -63,11 +63,11 @@ export default { name: 'spell-card', props: { name: String, - description: Array, - level: String, + description: String, + level: Number, schools: Array, - ingredients: String, - charge: String, + ingredients: Array, + charge: Number, cost: String, variables: Array, }, diff --git a/client/src/components/spells/spells-list.vue b/client/src/components/spells/spells-list.vue new file mode 100644 index 0000000..8103ea9 --- /dev/null +++ b/client/src/components/spells/spells-list.vue @@ -0,0 +1,47 @@ + + + + + \ No newline at end of file diff --git a/client/src/pages/spells.vue b/client/src/pages/spells.vue index 6029cc4..8e468f8 100644 --- a/client/src/pages/spells.vue +++ b/client/src/pages/spells.vue @@ -1,34 +1,19 @@ diff --git a/index.js b/index.js index 08ca67d..2ff401a 100644 --- a/index.js +++ b/index.js @@ -2,8 +2,9 @@ // MODULES const express = require('express') -const cors = require('cors') +const cors = require('cors') // module to format the json response +// Creates instances of database connections const connection = require('./database/connection') const db = connection.db @@ -13,11 +14,14 @@ const port = 2814 // Import routes const routes = require('./routes') -// Builds app +// Builds app w/ express let app = express() app.use(cors()) -const server = app.listen( port, () => { console.log(`App listening on port ${port}`)} ) +// Serves +const server = app.listen( port, () => {console.log(`App listening on port ${port}`)}) + +// Routing app.use('/api/spells', routes.spells) // On process kill with SIGINT diff --git a/routes/spells.js b/routes/spells.js index 1b33aca..c74775c 100644 --- a/routes/spells.js +++ b/routes/spells.js @@ -92,7 +92,7 @@ router getSpells(req.query) .then(v => { res.setHeader('Content-Type', 'application/json') - res.end(JSON.stringify({spells : v})) + res.end(JSON.stringify(v)) }) .catch(err => { console.log(err)