Skip to content

Commit

Permalink
example: update sub-app
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Jan 23, 2018
1 parent 208240f commit 90c1fd2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/sub-app/index.js
Expand Up @@ -9,9 +9,9 @@ function reply(req, res) {

// Main app
polka()
.use(users)
.get('/', reply)
.get('/about', reply)
.use('users', users)
.listen(PORT).then(_ => {
console.log(`> Running on localhost:${PORT}`);
});
4 changes: 2 additions & 2 deletions examples/sub-app/users.js
@@ -1,10 +1,10 @@
const polka = require('polka');

module.exports = polka()
.get('/users/:id?', (req, res) => {
.get('/:id?', (req, res) => {
res.end(`Sub: Howdy from ${req.method} ${req.url}`);
})
.put('/users/:id', (req, res) => {
.put('/:id', (req, res) => {
res.statusCode = 201; // why not?
res.end(`Sub: Updated user via ${req.method} ${req.url}`);
});

0 comments on commit 90c1fd2

Please sign in to comment.