Commit 15d7e05d authored by dm171558's avatar dm171558
Browse files

Setup Express.js Server

* Setup Http Server
* Using Http Server for Express Server
* Running Server on designated port
* Serving files from public folder
> index.html
> style.css
> main.js
parent 88d6abea
import * as Express from 'express';
import * as http from 'http';
import * as dotenv from 'dotenv';
import * as path from 'path';
export default class Server
private server: any;
private app: Express;
dotenv.config(); = new Express();
this.server = new http.Server(;
const port = process.env.SERVER_PORT || 3000;
const rootPath = path.dirname(require.main.filename);
console.log('Server runs on Port: ' + port);
this.server.listen(port);, 'public')));'/', (req, res) => {
res.sendFile(path.join(rootPath, 'public/index.html'));
import Server from './config/server';
new Server();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment