venmjs
Version:
This is a tool 🔧 that can be installed in your terminal at any time ⛏️ it was made for beginners and even for experts, for his utilities, and for a simple creation process 🧨. Every web developer knows how frustrating is to deal with the creation of a ne
32 lines (21 loc) • 631 B
JavaScript
// Importing required modules
const cors = require('cors');
const express = require('express');
// parse env variables
require('dotenv').config();
require("./helpers/db/mongodb.js")();
// Configuring port
const port = process.env.PORT || 9000;
const app = express();
// Configure middlewares
app.use(cors());
app.use(express.json());
app.set('view engine', 'html');
// Static folder
app.use(express.static(__dirname + '/views/'));
// Defining route middleware
app.use('/api', require('./routes/api'));
// Listening to port
app.listen(port);
console.log(`Listening On http://localhost:${port}/api`);
module.exports = app;