Skip to content

Commit

Permalink
Initial structure for resume endpoints is working
Browse files Browse the repository at this point in the history
  • Loading branch information
malaquiasdev committed May 14, 2018
1 parent 3142047 commit 214c6a3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions api/src/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const {resumesFindAll} = require('./resumes.routes')
const {findAll, save} = require('./resumes.routes')

const routes = (server) => {
server.get('/api/v1/resumes', resumesFindAll)
server.post('/api/v1/resumes', save)
server.get('/api/v1/resumes', findAll)
}

module.exports = routes
13 changes: 11 additions & 2 deletions api/src/routes/resumes.routes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
const findAll = (req, res) => {
return res.send({message: `I'M A LIVE... lol`})
return res.send([
{id: 1, value: 'test 1'},
{id: 2, value: 'test 2'}
])
}

const save = (req, res) => {
const {name} = req.params
res.send(name)
}

module.exports = {
resumesFindAll: findAll
findAll: findAll,
save: save
}
1 change: 1 addition & 0 deletions api/src/server/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const factoryServer = () => {

server.pre(cors.preflight)
server.use(cors.actual)
server.use(restify.plugins.bodyParser())

routes(server)

Expand Down

0 comments on commit 214c6a3

Please sign in to comment.