-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
51 lines (42 loc) · 1.84 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
const express = require('express');
const bodyParser = require('body-parser');
const knex = require('knex');
const cors = require('cors');
const login = require('./controllers/login');
const register = require('./controllers/register');
const aadhaar = require('./controllers/aadhaar');
const g_form = require('./controllers/grievance_form');
const dashboard = require('./controllers/dashboard');
const adm_dashboard = require('./controllers/adm_dashboard');
const dept_user = require('./controllers/dept_user');
const response = require('./controllers/response');
const webtraffic = require('./controllers/webtraffic');
const newresponse = require('./controllers/new_response');
const db = knex({
client: 'pg',
connection: {
host : '127.0.0.1',
user : 'postgres',
password : 'test',
database : 'dbms_project'
}
});
db.select('*').from('users').then(data=>{
console.log(data);
});
const app = express();
app.use(bodyParser.json());
app.use(cors());
app.post('/login', (req,res) => { login.handleLogin(req,res,db)} )
app.post('/register', (req,res) => { register.handleRegister(req,res,db)} )
app.post('/aadhaar', (req,res) => { aadhaar.handleAadhaar(req,res,db)} )
app.post('/grievance_submit', (req,res) => { g_form.handleGrievance(req,res,db)})
app.post('/dashboard', (req,res) => { dashboard.handleDashboard(req,res,db)})
app.post('/response', (req,res) => { response.handleResponse(req,res,db)} )
app.post('/adm_dashboard', (req,res) => { adm_dashboard.handleAdmin(req,res,db)} )
app.post('/dept_user', (req,res) => { dept_user.handleDept(req,res,db)} )
app.post('/webtraffic', (req,res) => { webtraffic.handleWebTraffic(req,res,db)} )
app.post('/new_response', (req,res) => { newresponse.handleNewResponse(req,res,db)} )
app.listen( 3000 , ()=>{
console.log('Server running on port 3000');
})