Skip to content
Permalink
Browse files

upgrade to now v2

  • Loading branch information...
amio committed Jan 29, 2019
1 parent b69de93 commit e1b6fd6beba3dfb789ce3a627e238170da76cc4c
Showing with 19 additions and 6 deletions.
  1. +1 −0 .npmignore
  2. +6 −1 example.config.js → example/index.js
  3. +4 −4 index.js
  4. +8 −1 now.json
@@ -1,4 +1,5 @@
test
example
.circleci
.travis.yml
ocelot.jpg
@@ -1,4 +1,6 @@
module.exports = {
const go = require('..')

const config = {
'/': 'https://github.com/amio/now-go',
'/tag': 'Now go, let the legend come back to life!',
'/hero': 'https://amio.github.io/now-go/ocelot.jpg',
@@ -10,3 +12,6 @@ module.exports = {
}
}
}

// Export an http server handler for now v2
module.exports = go.createHandler(config)
@@ -47,12 +47,12 @@ function _signpostHandler (signpost, req, res, depth) {
res.end('NOTFOUND')
}

function isURL (text) {
return isText(text) && /^https?:\/\/\w/.test(text)
function isURL (str) {
return isText(str) && /^https?:\/\/\w/.test(str)
}

function isText (text) {
return typeof text === 'string'
function isText (str) {
return typeof str === 'string'
}

function isFunc (signpost) {
@@ -1,3 +1,10 @@
{
"alias": "go"
"version": 2,
"alias": "go",
"builds": [
{ "src": "example/index.js", "use": "@now/node" }
],
"routes": [
{ "src": "/.*", "dest": "/example/index.js" }
]
}

0 comments on commit e1b6fd6

Please sign in to comment.
You can’t perform that action at this time.