Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
/*
IMPORTED MODULES
express : the framework
cors : cross-origin resource sharing
bodyParser : enabling HTTP POST request
*/
'use strict';
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
/*
EXPRESS SETTING
server var : making express object
bodyParser : parsing json
cors : enable all origins
*cors : enable complex routes
static : allow static files to serve images
*/
const server = express();
server.use(bodyParser.json());
server.use(cors());
server.options('*', cors());
server.use(express.static('public'));
//main routes for api end point
const routes = require('./routes');
routes.allRoutes(server);
//port number
let port = 8080;
//start server
server.listen(port, err => {
if (err) {
console.error(err)
} else {
console.log(`StuTrade BackEnd Running at PORT: ${port}`);
}
});