You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import express from 'express';
|
|
|
|
import cors from 'cors';
|
|
|
|
import config from './config/config.js';
|
|
|
|
import database_service from './services/database_service.js';
|
|
|
|
import router from './router/router.js';
|
|
|
|
|
|
|
|
const App = express();
|
|
|
|
App.use(express.json());
|
|
|
|
App.use(cors());
|
|
|
|
|
|
|
|
const onListening = () => {
|
|
|
|
console.log(`Server is listening on port ${config.PORT}`);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
database_service.connect()
|
|
|
|
.then( () => {
|
|
|
|
App.listen(config.PORT, onListening);
|
|
|
|
}).catch( (e) => {
|
|
|
|
console.log(`The error is ${e}`);
|
|
|
|
})
|
|
|
|
|
|
|
|
App.use("/api/variant1", router);
|