Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vue-ssr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lixy
vue-ssr
Commits
34614254
Commit
34614254
authored
Sep 09, 2019
by
lixy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://113.105.137.151:22280/lixy/vue-ssr
parents
ccd47f38
6de3c837
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
3 deletions
+43
-3
package.json
package.json
+3
-3
.gitkeep
server/.gitkeep
+0
-0
index.js
server/index.js
+40
-0
No files found.
package.json
View file @
34614254
{
"name"
:
"
li
"
,
"name"
:
"
xxcom-pc
"
,
"version"
:
"1.0.0"
,
"description"
:
"Nuxt.js project"
,
"author"
:
"lixy <929545354@qq.com>"
,
...
...
@@ -12,8 +12,8 @@
"build:test"
:
"cross-env MODE=test nuxt build"
,
"build:pro"
:
"cross-env MODE=pro nuxt build"
,
"start"
:
"cross-env MODE=dev nuxt start"
,
"start:test"
:
"cross-env MODE=test nuxt start --hostname 10.5.52.3 --port 3000"
,
"start:pro"
:
"cross-env MODE=pro nuxt start --hostname 10.5.52.2 --port 3000"
,
"start:test"
:
"cross-env MODE=test nuxt start --hostname 10.5.52.3 --port 3000
--name 'xxcom-pc'
"
,
"start:pro"
:
"cross-env MODE=pro nuxt start --hostname 10.5.52.2 --port 3000
--name 'xxcom-pc'
"
,
"generate"
:
"cross-env MODE=dev nuxt generate"
,
"lint"
:
"eslint --ext .js,.vue --ignore-path .gitignore ."
,
"precommit"
:
"npm run lint"
...
...
server/.gitkeep
0 → 100644
View file @
34614254
server/index.js
0 → 100644
View file @
34614254
const
express
=
require
(
'express'
)
const
consola
=
require
(
'consola'
)
const
proxy
=
require
(
'express-http-proxy'
)
const
{
Nuxt
,
Builder
}
=
require
(
'nuxt'
)
// const PROXY_URL = 'http://localhost:9000'; // 反向代理域名,测试
const
PROXY_URL
=
'http://elm-api.caibowen.net'
;
// 反向代理域名,生产
const
app
=
express
()
const
port
=
process
.
env
.
PORT
||
3000
app
.
set
(
'port'
,
port
)
// Import and Set Nuxt.js options
let
config
=
require
(
'../nuxt.config.js'
)
config
.
dev
=
!
(
process
.
env
.
NODE_ENV
===
'production'
)
app
.
use
(
'/api'
,
proxy
(
PROXY_URL
));
async
function
start
()
{
// Init Nuxt.js
const
nuxt
=
new
Nuxt
(
config
)
// Build only in dev mode
if
(
config
.
dev
)
{
const
builder
=
new
Builder
(
nuxt
)
await
builder
.
build
()
}
// Give nuxt middleware to express
app
.
use
(
nuxt
.
render
)
// Listen the server
app
.
listen
(
port
)
consola
.
ready
({
message
:
`Server listening on http://localhost:
${
port
}
`
,
badge
:
true
})
}
start
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment