Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit 26ecd50

Browse files
author
sw-yx
committed
small bugfix for this.log
1 parent 615eb6e commit 26ecd50

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/commands/functions/create.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class FunctionsCreateCommand extends Command {
1616
const { flags, args } = this.parse(FunctionsCreateCommand)
1717
const { config } = this.netlify
1818

19-
const functionsDir = ensureFunctionDirExists(flags, config)
19+
const functionsDir = ensureFunctionDirExists(flags, config, this.log)
2020

2121
/* either download from URL or scaffold from template */
2222
if (flags.url) {
@@ -103,16 +103,16 @@ async function pickTemplate() {
103103
}
104104

105105
/* get functions dir (and make it if necessary) */
106-
function ensureFunctionDirExists(flags, config) {
106+
function ensureFunctionDirExists(flags, config, log) {
107107
const functionsDir = flags.functions || (config.build && config.build.functions)
108108
if (!functionsDir) {
109-
this.log('No functions folder specified in netlify.toml or as an argument')
109+
log('No functions folder specified in netlify.toml or as an argument')
110110
process.exit(1)
111111
}
112112
if (!fs.existsSync(functionsDir)) {
113-
console.log(`functions folder ${functionsDir} specified in netlify.toml but folder not found, creating it...`)
113+
log(`functions folder ${functionsDir} specified in netlify.toml but folder not found, creating it...`)
114114
fs.mkdirSync(functionsDir)
115-
console.log(`functions folder ${functionsDir} created`)
115+
log(`functions folder ${functionsDir} created`)
116116
}
117117
return functionsDir
118118
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// for a full working demo check https://express-via-functions.netlify.com/.netlify/functions/serverless-http
2+
const serverless = require('serverless-http')
3+
const expressApp = require('./app')
4+
5+
// We need to define our function name for express routes to set the correct base path
6+
const functionName = 'serverless-http'
7+
8+
// Initialize express app
9+
const app = expressApp(functionName)
10+
11+
// Export lambda handler
12+
exports.handler = serverless(app)

0 commit comments

Comments
 (0)