Skip to content

Instantly share code, notes, and snippets.

@pajtai
Created May 4, 2018 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pajtai/cb140f0f53f159ed2fba9ad25fe9dda7 to your computer and use it in GitHub Desktop.
Save pajtai/cb140f0f53f159ed2fba9ad25fe9dda7 to your computer and use it in GitHub Desktop.
'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