issue #1: commit inicial

parent aba527e9
......@@ -25,13 +25,15 @@ const app = express();
app.use("/", bodyParser.json());
app.use("/", dbhMW());
app.post("/inicio", (req: Request, res: express.Response) => {
const jogador: Jogador = new Jogador(req.body.nome, [], [], 0);
req.db.createplayer(jogador);
console.log(req.db.readplayer(0).writeinfo());
console.log(jogador.writeinfo());
res.json(jogador.writeinfo());
});
app.post("/", (req: Request, res: express.Response) => {
app.get("/", (req: Request, res: express.Response) => {
const jogo1: Jogo = new Jogo("Portal 2", "Valve", "Valve", new Date("2012-01-01"), 25);
const jogo2: Jogo = new Jogo("The Witcher 3", "CD Projekt RED", "CD Projekt RED", new Date("2016-01-01"), 10);
......@@ -50,8 +52,10 @@ app.get("/perfil/Robin", (req: Request, res: express.Response) => {
res.json(req.db.readplayer(1).writeinfo());
});
app.get("/perfil/Batman", (req: Request, res: express.Response) => {
res.json(req.db.readplayer(0).writeinfo());
app.get("/perfil/:nome", (req: Request, res: express.Response) => {
const ID: number = req.db.list("jogadores").indexOf(req.params.nome);
console.log(ID);
res.json(req.db.readplayer(ID).writeinfo());
});
app.get("/catalogo", (req: Request, res: express.Response) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment