Skip to content

Commit

Permalink
Merge pull request #74 from navikt/personroute
Browse files Browse the repository at this point in the history
routes for person lookup
  • Loading branch information
jksolbakken authored Aug 8, 2019
2 parents 13adb43 + c6d7d92 commit b2d1e23
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions src/server/personroutes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

const personLookup = require('./personlookup');

const setup = (app, config) => {
personLookup.init(config);
routes(app);
};

const routes = app => {
app.get('/person/:aktorId', (req, res) => {
const aktørId = req.params.aktorId;
personLookup
.hentPerson(aktørId)
.then(person => {
res.send(person);
})
.catch(err => {
console.log(err);
res.sendStatus(500);
});
});
};

module.exports = {
setup: setup
};
8 changes: 6 additions & 2 deletions src/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ const config = require('./config');
const authsupport = require('./authsupport');
const metrics = require('./metrics');
const headers = require('./headers');
const behandlinger = require('./behandlinger');
const feedback = require('./feedback');

const behandlinger = require('./behandlingerroutes');
const feedback = require('./feedbackroutes');
const person = require('./personroutes');

const app = express();
const port = config.server.port;
Expand Down Expand Up @@ -111,6 +113,8 @@ feedback
);
});

person.setup(app, config.nav);

app.get('/', (_, res) => {
res.redirect('/static');
});
Expand Down

0 comments on commit b2d1e23

Please sign in to comment.