Skip to content

Instantly share code, notes, and snippets.

@Pierre-RA
Created October 4, 2017 11:33
Show Gist options
  • Save Pierre-RA/254ad481f60e986cd733769a4e5afa96 to your computer and use it in GitHub Desktop.
Save Pierre-RA/254ad481f60e986cd733769a4e5afa96 to your computer and use it in GitHub Desktop.
import * as express from 'express';
import * as dotenv from 'dotenv';
import * as bodyParser from 'body-parser';
import * as homeController from './controllers/home.controller';
dotenv.config();
const app = express();
app.set('port', process.env.PORT || 3000);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.get('/', homeController.index);
app.listen(app.get('port'), () => {
console.log(('App is running at http://localhost:%d in %s mode'),
app.get('port'), app.get('env'));
console.log('Press CTRL-C to stop\n');
});
module.exports = app;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment