This repository has been archived on 2026-05-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
chatless/backend/service-authentication/server.js
2021-05-28 01:01:00 +02:00

32 lines
767 B
JavaScript

const express = require('express');
const app = express();
const port = process.env.PORT || 3000;
const cookieParser = require('cookie-parser');
app.use(cookieParser());
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
const cors = require('cors');
app.use(cors({origin: 'http://127.0.0.1:4200', credentials: true}));
const mongoConnect = require('./mongodbConnect');
mongoConnect.connectToServer(function( err, client ) {
if (err)
console.log(err);
const checkLogin = require('./checkLogin');
app.post('/checkLogin', (req, res) => {
checkLogin(req,res);
});
app.listen(port, () => {
console.log (`listening on port ${port}`);
});
});