Skip to content

Expose API #6

@8eecf0d2

Description

@8eecf0d2

Would be handy to expose an API so test runners can start & stop the server, optionally with the build system.

Usage

import { parseNetlifyConfig, parseWebpackConfig, Server, Webpack } from "netlify-local"; const netlifyConfig = parseNetlifyConfig("netlify.toml"); const port = 3000; const server = new Server({ netlifyConfig: netlifyConfig, routes: { static: true, lambda: true, }, certificates: { key: <private key as a string>, cert: <certificate as a string>, }, port: 9000, }); await server.listen(); await server.close(); const webpackConfig = parseWebpackConfig("webpack.config.js"); const webpack = new Webpack(webpackConfig); await webpack.build(); webpack.watch();

Methods

Config

  • parseNetlifyConfig()
  • parseWebpackConfig()

Server

  • constructor
  • Server.listen()
  • Server.close()

Webpack

  • constructor
  • Webpack.build()
  • Webpack.watch()

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestimplementedImplemented in master but the issue is still relevant

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions