Compare commits

..

6 Commits

Author SHA1 Message Date
IrisVega 99e4e8b3d8 modified: src/components/LoginForm.vue 2024-07-11 17:26:11 +08:00
IrisVega de67edeb4e modified: server/server.js 2024-07-11 16:59:46 +08:00
IrisVega 043c0a922a modified: server/server.js 2024-07-11 16:56:20 +08:00
IrisVega 1d5009c51c modified: src/components/LoginForm.vue 2024-07-11 16:48:07 +08:00
IrisVega bdb34c9bf7 modified: server/server.js 2024-07-11 16:29:24 +08:00
IrisVega 8e2335bf71 modified: server/server.js 2024-07-11 16:28:58 +08:00
2 changed files with 8 additions and 8 deletions

View File

@ -4,14 +4,14 @@ const bodyParser = require('body-parser');
const cors = require('cors'); const cors = require('cors');
const path = require('path'); const path = require('path');
const app = express(); const app = express();
const port = 3000; const port = 4040;
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(cors()); app.use(cors());
// 创建 MySQL 连接 // 创建 MySQL 连接
const db = mysql.createConnection({ const db = mysql.createConnection({
host: '1.14.200.189', host: '172.17.0.1',
user: 'login_test', user: 'login_test',
password: 'tTiwnNbzMeLFxbLj', password: 'tTiwnNbzMeLFxbLj',
database: 'login_test' database: 'login_test'
@ -67,5 +67,5 @@ app.get('*', (req, res) => {
}); });
app.listen(port, () => { app.listen(port, () => {
console.log(`服务器在 http://localhost:${port} 上运行`); console.log(`服务器在 http://0.0.0.0:${port} 上运行`);
}); });

View File

@ -55,7 +55,7 @@ export default {
methods: { methods: {
async login() { async login() {
try { try {
const response = await fetch('http://localhost:3000/api/login', { const response = await fetch('http://1.14.200.189:4040/api/login', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@ -74,7 +74,7 @@ export default {
}, },
async register() { async register() {
try { try {
const response = await fetch('http://localhost:3000/api/register', { const response = await fetch('http://1.14.200.189:4040/api/register', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@ -97,11 +97,11 @@ export default {
</script> </script>
<style scoped> <style scoped>
auth-container { .auth-container {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: calc(100vh-100px); height: calc(100vh);
background-color: rgba(255,255,255,0); background-color: rgba(255,255,255,0);
} }