-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
77 lines (53 loc) · 2.45 KB
/
index.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const express = require('express');
const cors = require('cors');
const port = process.env.PORT || 5000;
const app = express();
app.use(cors());
app.use(express.json());
// products pharmacy api routes
app.use('/api/products/pharmacy', require('./routes/api/products/pharmacy'));
// products non pharmacy api routes
app.use('/api/products/nonPharmacy', require('./routes/api/products/nonPharmacy'));
// requested items pharmacy api routes
app.use('/api/requestedItems/pharmacy', require('./routes/api/requestedItems/pharmacy'));
// requested items non pharmacy api routes
app.use('/api/requestedItems/nonPharmacy', require('./routes/api/requestedItems/nonPharmacy'));
// orders pharmacy api routes
app.use('/api/orders/pharmacy', require('./routes/api/orders/pharmacy'));
// orders non pharmacy api routes
app.use('/api/orders/nonPharmacy', require('./routes/api/orders/nonPharmacy'));
// orders pharmacy api routes
app.use('/api/purchases/pharmacy', require('./routes/api/orders/pharmacy'));
// orders non pharmacy api routes
app.use('/api/purchases/nonPharmacy', require('./routes/api/orders/nonPharmacy'));
// categories api routes
app.use('/api/setup/categories', require('./routes/api/setup/categories'));
// companies api routes
app.use('/api/setup/companies', require('./routes/api/setup/companies'));
// unit types api routes
app.use('/api/setup/unitTypes', require('./routes/api/setup/unitTypes'));
// employees api routes
app.use('/api/employees', require('./routes/api/employees/employees'));
// customers api routes
app.use('/api/customers', require('./routes/api/customers/customers'));
// customers returns api routes
app.use('/api/returns/customers', require('./routes/api/returns/customersReturns'));
// expires or damages returns api routes
app.use('/api/returns/expiresOrDamagesReturns', require('./routes/api/returns/expiresOrDamagesReturns'));
// suppliers documents api routes
app.use('/api/suppliers/documents', require('./routes/api/suppliers/documents'));
// suppliers lists api routes
app.use('/api/suppliers/lists', require('./routes/api/suppliers/lists'));
// suppliers payments api routes
app.use('/api/suppliers/payments', require('./routes/api/suppliers/payments'));
// index route
app.get('/', (req, res) => {
res.send('Welcome to Inventory Management System Server');
});
// invalid route
app.get('*', (req, res) => {
res.status(400).json({ message: `Invalid route.` });
});
app.listen(port, () => {
console.log(`listening on port ${port}`);
});