-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
351 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Only Server | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
# 安装 Node.js 和 npm | ||
- name: Install Node.js and npm | ||
uses: actions/setup-node@v2.1.5 | ||
with: | ||
node-version: '18' | ||
|
||
# 后端构建步骤 | ||
- name: Build and start Node.js server | ||
working-directory: ./ | ||
run: | | ||
npm install | ||
sudo node app.js | ||
env: | ||
NODE_ENV: production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const app = require('express')(); | ||
|
||
const port = 80; | ||
|
||
app.use((req, res, next) => { | ||
res.header('Access-Control-Allow-Headers', '*'); | ||
res.header('Access-Control-Allow-Origin', '*'); | ||
if (req.method === 'OPTIONS') { | ||
res.sendStatus(200); | ||
} else { | ||
next(); | ||
} | ||
}); | ||
|
||
app.get('/', (req, res) => { | ||
res.send('hello world'); | ||
}); | ||
|
||
app.listen(port, () => { | ||
console.log(`server is running on localhost:${port}`); | ||
}); |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.