123456789101112131415161718192021222324252627 |
- //© 2019 Dublin City University, Trinity College Dublin. All rights reserved. This material may not be reproduced, displayed, modified or distributed without the express prior written permission of the copyright holder.
- import express from 'express';
- import cors from 'cors';
- import bodyParser from 'body-parser';
- import router from './routes';
- import mongoose from 'mongoose';
- import httpContext from 'express-http-context';
- const app = express();
- mongoose.connect('mongodb://localhost/knowledgeBaseDB', { useNewUrlParser: true });
- mongoose.Promise = global.Promise;
- //app.use(httpContext.middleware);
- app.use(cors());
- // Parse incoming requests data
- app.use(bodyParser.json());
- app.use(bodyParser.urlencoded({ extended: false }));
- app.use(router);
- const PORT = 5000;
- app.listen(PORT, () => {
- console.log(`server running on port ${PORT}`);
- });
|