@2890594972
2017-12-25T04:13:50.000000Z
字数 3571
阅读 846
云服务器
sina
http://www.saebbs.com/forum.php?mod=viewthread&tid=37798
PS D:\bw\1506\sina\anli> npm init
...
Press ^C at any time to quit.
package name: (anli)
version: (1.0.0)
description: anli
entry point: (index.js)
test command: start
git repository: (https://git.sinacloud.com/anli)
keywords:
author: daxiang
license: (ISC)
...
Is this ok? (yes) yes
// server.js
var express = require('express')
var app = express()
// 静态 html 页面,需要将当前目录下的所有文件都设置为 static
app.use(express.static(__dirname + '/static/'));
app.get('/', function (req, res) {
console.log('start server');
// sendFile 函数,在有 request 访问时,将当前目录下的 index.html 文件作为 response 返回
res.sendFile(__dirname + '/index.html');
console.log('start success');
})
// 监听 8000 端口
app.listen(process.env.PORT || 8000)
daxiang@daxiang MINGW64 /d/bw/1506/sina/anli (master)
$ git status
On branch master
Your branch is based on 'origin/master', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: README.md
new file: config.yaml
new file: index.js
new file: package-lock.json
new file: package.json
daxiang@daxiang MINGW64 /d/bw/1506/sina/anli (master)
$ git add .
daxiang@daxiang MINGW64 /d/bw/1506/sina/anli (master)
$ git commit -m 'add hello world'
[master d1530f6] add hello world
5 files changed, 421 insertions(+)
create mode 100644 README.md
create mode 100644 config.yaml
create mode 100644 index.js
create mode 100644 package-lock.json
create mode 100644 package.json
daxiang@daxiang MINGW64 /d/bw/1506/sina/anli (master)
$ git push origin
Counting objects: 11, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 5.55 KiB | 1.39 MiB/s, done.
Total 11 (delta 0), reused 0 (delta 0)
remote: 导出 Git 代码中...
remote: 构建程序中...
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 5.9.0
engines.npm (package.json): unspecified (use default)
Downloading and installing node 5.9.0...
Using default npm version: 3.7.3
-----> Restoring cache
Skipping cache restore (new runtime signature)
-----> Building dependencies
Pruning any extraneous modules
Installing node modules (package.json)
nodejs-getting-started@0.0.1 /tmp/build
`-- express@4.16.2
+-- accepts@1.3.4
| +-- mime-types@2.1.17
| | `-- mime-db@1.30.0
| `-- negotiator@0.6.1
+-- array-flatten@1.1.1
+-- body-parser@1.18.2
| +-- bytes@3.0.0
| +-- http-errors@1.6.2
| | +-- inherits@2.0.3
| | `-- setprototypeof@1.0.3
| +-- iconv-lite@0.4.19
| `-- raw-body@2.3.2
+-- content-disposition@0.5.2
+-- content-type@1.0.4
+-- cookie@0.3.1
+-- cookie-signature@1.0.6
+-- debug@2.6.9
| `-- ms@2.0.0
+-- depd@1.1.1
+-- encodeurl@1.0.1
+-- escape-html@1.0.3
+-- etag@1.8.1
+-- finalhandler@1.1.0
| `-- unpipe@1.0.0
+-- fresh@0.5.2
+-- merge-descriptors@1.0.1
+-- methods@1.1.2
+-- on-finished@2.3.0
| `-- ee-first@1.1.1
+-- parseurl@1.3.2
+-- path-to-regexp@0.1.7
+-- proxy-addr@2.0.2
| +-- forwarded@0.1.2
| `-- ipaddr.js@1.5.2
+-- qs@6.5.1
+-- range-parser@1.2.0
+-- safe-buffer@5.1.1
+-- send@0.16.1
| +-- destroy@1.0.4
| `-- mime@1.4.1
+-- serve-static@1.13.1
+-- setprototypeof@1.1.0
+-- statuses@1.3.1
+-- type-is@1.6.15
| `-- media-typer@0.3.0
+-- utils-merge@1.0.1
`-- vary@1.1.2
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
- nodegyp_lib (nothing to cache)
-----> Build succeeded!
`-- express@4.16.2
-----> Discovering process types
Default types for -> web
-----> Compiled slug size is 13M
remote: Generating docker image...
remote: Pushing image registry.docker.sae.sina.com.cn/anli:d1530f6 .....
remote: 部署程序中 ..........
To https://git.sinacloud.com/anli
* [new branch] master -> master