mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
24 lines
532 B
JavaScript
24 lines
532 B
JavaScript
'use strict';
|
|
|
|
const fetch = require('node-fetch');
|
|
|
|
function deployFunctionToLocalEmulator(serviceName, functionName, config) {
|
|
const localEmulatorDeployEndpoint = 'http://localhost:8082/v0/emulator/api/functions';
|
|
const payload = {
|
|
serviceName,
|
|
functionName,
|
|
config,
|
|
};
|
|
|
|
return fetch(localEmulatorDeployEndpoint, {
|
|
headers: {
|
|
'content-type': 'application/json',
|
|
},
|
|
method: 'POST',
|
|
timeout: 1000,
|
|
body: JSON.stringify(payload),
|
|
});
|
|
}
|
|
|
|
module.exports = deployFunctionToLocalEmulator;
|