如何运行一个使用npm启动服务器的网站

How to run a website that uses npm to start the server

我和几个朋友一直致力于开发一些实验。我想把它们放在 URL 上,这样我们就可以与其他人分享。

但是,除了静态网页之外,我没有设置服务器的经验。

在我的 package.json 文件中有一个命令,我 运行 在我的终端 window 中构建它是:npm run watch & serve public/ -p 1618

  "scripts": {
    "start": "npm run build && serve --compress public/ -p 1618",
    "dev": "npm run watch & serve public/ -p 1618",
  },

如何设置它才能在 URL 上显示?基本上就像一个网站,我有域名只是不知道在哪里或如何设置它。

谢谢!

注册免费的 Heroku 帐户并根据需要进行升级。 https://www.heroku.com/beta-pricing

这是他们针对 node.js 的部署说明。 https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction

另一个提供免费选项的主机是 OpenShift。