Skip to content

Commit

Permalink
only server
Browse files Browse the repository at this point in the history
  • Loading branch information
xygodcyx committed May 22, 2024
1 parent 9af0055 commit dfae30b
Show file tree
Hide file tree
Showing 12 changed files with 351 additions and 599 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/only server.yml
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
21 changes: 21 additions & 0 deletions app.js
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}`);
});
20 changes: 0 additions & 20 deletions node_modules/function-bind/.editorconfig

This file was deleted.

16 changes: 11 additions & 5 deletions node_modules/function-bind/.eslintrc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

176 changes: 0 additions & 176 deletions node_modules/function-bind/.jscs.json

This file was deleted.

22 changes: 0 additions & 22 deletions node_modules/function-bind/.npmignore

This file was deleted.

Loading

0 comments on commit dfae30b

Please sign in to comment.