Created
January 29, 2018 18:23
-
-
Save knksmith57/7fc07b3bfb8edd7f995b3ce856b75fd4 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
'use strict' | |
const express = require('express') | |
const app = express() | |
app.get('/', (req, res) => { | |
res.send('index') | |
}) | |
app.get('/foo', (req, res) => { | |
res.send('foo') | |
}) | |
app.get('/bar', (req, res) => { | |
res.send('bar') | |
}) | |
module.exports.handler = (req, res) => { | |
if (req.url === '') { | |
req.url = '/' | |
} | |
app.handle(req, res) | |
} | |
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
{ | |
"dependencies": { | |
"express": "^4.16.2" | |
} | |
} |
Author
knksmith57
commented
Jan 29, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment