/* This is main file which will contain all of our endpoints. Once we have enough endpoints defined we start breaking them into modules for better code readability */ // Importing all the required libraries var express = require('express'); var bodyParser = require('body-parser'); //body parser to parse the request body var db = require('./db.js'); //this file contains the knex file import. it's equal to knex=require('knex') var app = express(); // Using the body parser middleware to parse request body app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); app.get('/api',function(req,res){ // this is just a sample endpoint I build to see if things are working res.send("Hey! You're looking at the matterwiki API"); }); // Importing all endpoints for articles require('./api/articles')(app); // Importing all endpoints for topics require('./api/topics')(app); // Importing all endpoints for users require('./api/users')(app); app.use(express.static(__dirname + '/client')); app.listen(5000 || process.env.PORT, function(){ console.log("The magic is happening on port 5000"); });