-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
27 lines (22 loc) · 851 Bytes
/
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
// import rquired module
let route_Module=require("./routeModule/api_routes");
let express=require("express");
let app=express();
let cors=require('cors')
let bodyParser=require("body-parser");
app.use(cors())
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended:false}))
app.use(express.json());
// define route module
let defined_route_module=new route_Module();
// define api routes
app.get("/api/snip_url",defined_route_module.snip_url);
app.get("/api/getOriginalUrl/:reference_id",defined_route_module.getOriginalUrl);
app.get("/api/test",(req,res)=>{res.json({msg:"api is working fine"})} )
app.get("/check_status",(req,res)=>{res.json({status:"Server active "})})
app.get("/api/getAllData",defined_route_module.getAllData)
// config api server
app.listen(4005,async()=>{
console.log("snip api server is running")
})