-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2b6e31
commit 24d02b9
Showing
15 changed files
with
213 additions
and
8,457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ git | |
node_modules | ||
build | ||
npm-debug.log | ||
yarn-error.log | ||
scrape | ||
.env | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require('dotenv').config(); | ||
|
||
const express = require('express'); | ||
const app = express(); | ||
const router = express.Router(); | ||
const bodyParser = require('body-parser'); | ||
const cors = require('cors') | ||
|
||
const fs = require('fs'); | ||
const port = process.env.PORT || 8080; | ||
|
||
app.use(bodyParser.urlencoded({extended: true})); | ||
app.use(bodyParser.json()); | ||
app.set('json spaces', 2); | ||
app.use(cors()) | ||
|
||
|
||
// test route to make sure everything is working | ||
router.get('/', function(req, res) { | ||
res.json({message: 'It Works! Welcome to the CardDB API!'}); | ||
}); | ||
|
||
// dynamically load our routes | ||
fs.readdirSync('./routes/').forEach(function(file) { | ||
if(file.indexOf('.js') > 0){ | ||
var route="./routes/"+file; | ||
require(route)(router); | ||
} | ||
}); | ||
|
||
// all of our routes will be prefixed with /api | ||
app.use('/v1', router); | ||
|
||
// start the server | ||
app.listen(port); | ||
console.log('Magic happens on port ' + port); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SOLR_DEV_CONN_URL=http://<MY_SOLR_INSTANCE>/solr/<MY_SOLR_CORE> | ||
SOLR_LOCAL_CONN_URL=http://<MY_SOLR_INSTANCE>/solr/<MY_SOLR_CORE> | ||
|
||
MONGO_DEV_CONN_URL=mongodb://<MY_MONGO_INSTANCE> | ||
MONGO_LOCAL_CONN_URL=mongodb://<MY_MONGO_INSTANCE> | ||
MONGO_DB_NAME=<MY_DB_NAME> |
Oops, something went wrong.