Created
February 22, 2016 07:45
-
-
Save aldidas/6899f1569cd41516375c to your computer and use it in GitHub Desktop.
index.js express app
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
var express = require('express'), | |
r = require('./app/server/route'), | |
app = express(), | |
bodyParser = require('body-parser') | |
app.use(express.static('public')); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ | |
extended: true | |
})); | |
app.get('/api/posts', r.routes.getPosts); | |
app.get('/api/post/:id', r.routes.getItem); | |
app.post('/api/post', r.routes.postEntry); | |
app.listen(8000, function() { | |
console.log('server is running'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment