Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ PORT=3000
DB_HOST=localhost
DB_USER=root
DB_NAME=meit
DB_PASSWORD=amy8985
DB_PASSWORD=@dltpwls!
DB_PORT=3306
33 changes: 0 additions & 33 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,33 +0,0 @@
const express = require('express');
const path = require('path');
const mysql = require('mysql2/promise');
const dbConfig = require('./config/database');

const app = express();
const port = 3000;

app.use(express.static('public'));

app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'view.html'));
});

app.get('/api/data', async (req, res) => {
const connection = await mysql.createConnection(dbConfig);
try {
const [students] = await connection.execute('SELECT * FROM student');
const [lines] = await connection.execute('SELECT * FROM line');
res.json({ students, lines });
} catch (error) {
console.error('Error fetching data:', error);
res.status(500).json({ error: 'Error fetching data' });
} finally {
await connection.end();
}
});

app.listen(port, () => {
console.log(`Server running at http://localhost:${port}`);
});
// node app.js (터미널에서 이 코드로 실행)
//http://127.0.0.1:3000
10 changes: 0 additions & 10 deletions config/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,3 @@ module.exports = {
connectionLimit: 10, // SJ씨가 부하 우려해서 10초로 설정
queueLimit: 0
};

// module.exports = {
// host: 'localhost',
// user: 'root',
// database: 'meit',
// password: '@dltpwls!',
// waitForConnections: true,
// connectionLimit: 10,
// queueLimit: 0
// };
16 changes: 16 additions & 0 deletions node_modules/.bin/ejs

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

17 changes: 17 additions & 0 deletions node_modules/.bin/ejs.cmd

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

28 changes: 28 additions & 0 deletions node_modules/.bin/ejs.ps1

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

16 changes: 16 additions & 0 deletions node_modules/.bin/jake

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

17 changes: 17 additions & 0 deletions node_modules/.bin/jake.cmd

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

28 changes: 28 additions & 0 deletions node_modules/.bin/jake.ps1

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

Loading