-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
57 lines (45 loc) · 1.45 KB
/
server.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const mysql =require("mysql");
const express=require("express");
const bodyparser=require("body-parser")
const jwt=require("jsonwebtoken")
const knex=require("knex")({
client: 'mysql',
connection: {
"host":"localhost",
"user":"root",
"password":"pratik",
"database":"turing"
}});
var app=express();
app.use(bodyparser())
var categories = express.Router();
app.use('/categories',categories);
require('./Routes/category')(categories,knex)
var attributes = express.Router();
app.use('/attributes',attributes);
require('./Routes/attributes')(attributes,knex)
var products = express.Router();
app.use('/products',products);
require('./Routes/products')(products,knex)
var customer = express.Router();
app.use('/customer',customer );
require('./Routes/customer')(customer,knex,jwt)
var departments=express.Router();
app.use("/departments",departments)
require("./Routes/deparment")(departments,knex)
var shoppingcart=express.Router()
app.use("/shoppingcart",shoppingcart)
require("./Routes/shoppingcart")(shoppingcart,knex)
var tax=express.Router()
app.use("/tax",tax)
require("./Routes/tax")(tax,knex)
var shipping=express.Router()
app.use("/shipping",shipping)
require("./Routes/shipping")(shipping,knex)
var orders=express.Router()
app.use("/orders",orders)
require("./Routes/oders")(orders,knex)
var server=app.listen(9090,()=>{
var port=server.address().port;
console.log('http://localhost:'+port+"/departments/")
})