Skip to content

Commit

Permalink
Start express (#25)
Browse files Browse the repository at this point in the history
* Add api router'
;

'

* Create server file

* (feat) Rough out server structure
  • Loading branch information
rhinodavid authored and cashpw committed Oct 21, 2016
1 parent 6b7b1f6 commit cb638c6
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 1 deletion.
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
},
"homepage": "https://github.com/manatee-matinee/piddle#readme",
"devDependencies": {
"chai": "^3.5.0",
"eslint": "^3.8.1",
"eslint-config-airbnb": "^12.0.0",
"eslint-plugin-import": "^1.16.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.4.1"
"eslint-plugin-react": "^6.4.1",
"mocha": "^3.1.2"
},
"eslintConfig": {
"extends": "airbnb",
Expand All @@ -36,6 +38,10 @@
]
},
"dependencies": {
"body-parser": "^1.15.2",
"express": "^4.14.0",
"morgan": "^1.7.0",
"passport-venmo": "0.0.1",
"sequelize": "^3.24.4",
"sqlite3": "^3.1.6"
}
Expand Down
9 changes: 9 additions & 0 deletions server/handlers/apiHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const saveBill = (request, response) => {


};


module.exports = {
saveBill,
};
10 changes: 10 additions & 0 deletions server/routes/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const express = require('express');

const router = express.Router(); // eslint-disable-line

const handler = require('../handlers/apiHandler');

router.get('/bill/:id', /* funct to handle bill*/);
router.post('/bill', handler.saveBill);

module.exports = router;
25 changes: 25 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const express = require('express');

const morgan = require('morgan');

const api = require('./routes/api');

const auth = require('./routes/auth');

const app = express();

const path = require('path');

app.use(morgan('dev'));
app.use('body-parser');

app.use('/api', api);
app.use('/auth', auth);

app.use('/', express.static(path.join(__dirname, '/public')));

const port = process.env.PORT || 3000;
app.listen(port);

console.log(`Server listening on port: ${port}`);
module.exports = app;
11 changes: 11 additions & 0 deletions server/spec/apiHandlerSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const expect = require('chai').expect;

const bill = {
description: 'Tu Lan lunch',
tax: 2.46,
};


describe ('savebill', () => {

});

0 comments on commit cb638c6

Please sign in to comment.