Created
May 4, 2018 05:24
-
-
Save pajtai/cb140f0f53f159ed2fba9ad25fe9dda7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
require('dotenv').config(); | |
const express = require('express'); | |
const app = express(); | |
const helmet = require('helmet'); | |
const pino = require('pino'); | |
const logger = pino({ | |
level: process.env.LOG_LEVEL | |
}); | |
const { version } = require('./package'); | |
logger.info('starting app'); | |
app.use(helmet()); | |
app.get('/version', (req, res) => { | |
res.send({ version }); | |
}); | |
app.get('*', (req, res) => { | |
res.status(404).send({ message: 'Resource not found' }); | |
}); | |
logger.info(`listening at http://localhost:${process.env.PORT}`); | |
app.listen(process.env.PORT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment