问题
I'm new to "Angular", "typescript" and "Electron". I created a "server.js" file with the basic example of express. What is the correct way to create a local server for the local network?
I want to create an "Angular" "Electron" App with a button to run the express server, but I don't know what to code in order to execute the "server.js" file.
function runLocalServer() {
servidor = require('server.js'); // This line is a error!
....
Thanks for your help.
回答1:
TypeScript accepts a normal require()
as well as the import
syntax. For example:
const express = require('express');
// OR
import * as express from 'express';
来源:https://stackoverflow.com/questions/47993447/how-to-run-requireexpress-from-a-typescript-angular-component-in-electron-a