Created
December 8, 2016 20:02
-
-
Save w3cj/47149222e1c52fc521ae899dcdbabac3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
require('dotenv').config(); | |
const app = express(); | |
app.use(bodyParser.urlencoded({ extended: false })); | |
app.use(bodyParser.json()); | |
const knex = require('./db/knex'); | |
// Your routes go here! | |
app.get('/entity_name_here', (req, res) => { | |
knex('table_name_here') | |
.then(entities => { | |
res.json(entities); | |
}) | |
}); | |
const port = process.env.PORT || 3000; | |
app.listen(port, () =>{ | |
console.log(`Listening on ${port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment