-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
35 lines (30 loc) · 878 Bytes
/
app.js
File metadata and controls
35 lines (30 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var express = require('express');
var mysql = require('mysql');
var app = express();
var con;
app.use(express.static(__dirname+'/public'));
app.get('/',(req,res)=>{
res.sendFile(__dirname+'/public/src/index.html');
});
app.listen(8000);
// con = mysql.createConnection({
// host:'localhost',
// user:'root',
// password:'Deva@01234',
// database:'onlineshop'
// });
// var concallback = (err,res)=>{
// if(err) throw err;
// console.log(res);
// };
// con.connect((err)=>{
// if(err) throw err;
// console.log("Connected!!");
// //for first run
// /*
// con.query("CREATE DATABASE onlineshop;",concallback);
// con.query("USE onlineshop",concallback);
// con.query("CREATE TABLE USERLIST(ID INT NOT NULL AUTO_INCREMENT,NAME VARCHAR(30),PASSWORD VARCHAR(13),PRIMARY KEY(ID));",concallback);
// */
// con.query("SELECT * FROM USERLIST;",concallback);
// })