-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add api router' ; ' * Create server file * (feat) Rough out server structure
- Loading branch information
1 parent
6b7b1f6
commit cb638c6
Showing
5 changed files
with
62 additions
and
1 deletion.
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
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,9 @@ | ||
const saveBill = (request, response) => { | ||
|
||
|
||
}; | ||
|
||
|
||
module.exports = { | ||
saveBill, | ||
}; |
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,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; |
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,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; |
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,11 @@ | ||
const expect = require('chai').expect; | ||
|
||
const bill = { | ||
description: 'Tu Lan lunch', | ||
tax: 2.46, | ||
}; | ||
|
||
|
||
describe ('savebill', () => { | ||
|
||
}); |