31 lines
816 B
JavaScript
31 lines
816 B
JavaScript
|
import express from "express";
|
||
|
import bodyParser from "body-parser";
|
||
|
import Post from "./modules/type.post.js";
|
||
|
|
||
|
export default class Router{
|
||
|
constructor(){
|
||
|
const app = express();
|
||
|
app.use(bodyParser.urlencoded({ extended: false }))
|
||
|
|
||
|
// parse application/json
|
||
|
app.use(bodyParser.json())
|
||
|
app.get("*",async (req,res)=>{
|
||
|
console.log(JSON.stringify(req.body));
|
||
|
res.send();
|
||
|
})
|
||
|
app.post("*",async (req,res)=>{
|
||
|
switch(req.body.type){
|
||
|
case "post":
|
||
|
Post.operationSelect(req.body)
|
||
|
break;
|
||
|
default:
|
||
|
|
||
|
break;
|
||
|
}
|
||
|
console.log(JSON.stringify(req.body));
|
||
|
res.send();
|
||
|
})
|
||
|
|
||
|
app.listen(7598);
|
||
|
}
|
||
|
}
|