Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
feat(server): add server entry file
Browse files Browse the repository at this point in the history
feat(server): add server entry file
  • Loading branch information
Metnew committed Aug 23, 2017
1 parent cbe8819 commit 039df01
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/server/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
global.i18n = str => str
global.fetch = require('node-fetch')
/**
* @flow
* @file
*/
import express from 'express'
import chalk from 'chalk'
// import serverDecorator from './server'
const app: any = express()
const PORT: number = process.env.PORT || 3000
const serverModulePath =
process.env.NODE_ENV === 'production'
? './server' // Decorate server with all middlewares/routes for production
: '../../webpack_config/server' // Mount our server-side code to dev server

// Import app
require('./server')
const createServer: Function = require(serverModulePath).default
createServer(app)

// Start server
app.listen(PORT, () => {
console.log(chalk.green(`SERVER IS LISTENING ON ${PORT}`))
})

0 comments on commit 039df01

Please sign in to comment.