-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
38 lines (28 loc) · 838 Bytes
/
server.js
File metadata and controls
38 lines (28 loc) · 838 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
36
37
38
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
app.use(bodyParser.json());
const db = require('./app/config/db.config');
db.sequelize.sync();
const controller = require('./app/controllers/customer.controller')
app.get('/',(req,res)=> {
res.send("Hello");
})
app.post('/customers/new',(req,res)=> {
controller.createCustomers(req,res);
})
app.get('/customers',(req,res)=> {
controller.findAllCustomers(req,res);
})
app.get('/customers/:email',(req,res)=> {
controller.findCustomerByEmail(req,res);
})
app.put('/customers/update',(req,res)=>{
controller.updateCustomers(req,res);
})
app.delete('/customers/delete/:update',(req,res)=>{
controller.deleteCustomer(req,res);
})
app.listen(3000,()=>{
console.log("Server is running on port 3000");
})