Skip to content

Commit

Permalink
refactor of how we detect if the api exists to be better xplat
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpowell committed Feb 17, 2021
1 parent c5d4080 commit b5b935b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cli/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,13 @@ export async function start(startContext: string, program: CLIConfig) {
serveApiContent = `echo 'using api dev server at ${useApiDevServer}'`;
} else {
if (program.apiLocation && configFile?.apiLocation) {
const funcBinary = "func";
const funcBinary = "npx func";
// serve the api if and only if the user provides a folder via the --api-location flag
serveApiContent = `([ -d '${configFile?.apiLocation}' ] && (cd ${configFile?.apiLocation}; ${funcBinary} start --cors * --port ${program.apiPort})) || echo 'No API found. Skipping.'`;
if (fs.existsSync(configFile.apiLocation)) {
serveApiContent = `cd ${configFile.apiLocation} && ${funcBinary} start --cors * --port ${program.apiPort}`;
} else {
serveApiContent = "echo No API found. Skipping";
}
}
}

Expand Down

0 comments on commit b5b935b

Please sign in to comment.