Skip to content

Commit be5bd35

Browse files
committed
dia 4 - até 2 anos em 2 meses - ajustes
1 parent 331f46e commit be5bd35

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules/
2+
.DS_Store
+10-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
import { Request, Response } from 'express';
2-
import knex from '../database/connection';
1+
import { Request, Response } from "express";
2+
import knex from "../database/connection";
33

44
class ItemsController {
5+
async index(request: Request, response: Response) {
6+
const items = await knex("items").select("*");
57

6-
async index(request:Request, response: Response){
7-
const items = await knex('items').select('*')
8-
9-
const serializedItems = items.map(item => {
8+
const serializedItems = items.map((item) => {
109
return {
1110
id: item.id,
1211
title: item.title,
13-
image_url: `http://localhost:3333/uploads/${item.image}`,
14-
}
15-
})
16-
17-
return response.json(serializedItems)
18-
}
12+
image_url: `http://192.168.0.13:3333/uploads/${item.image}`,
13+
};
14+
});
1915

16+
return response.json(serializedItems);
17+
}
2018
}
2119

2220
export default ItemsController;

server/src/database/database.sqlite

0 Bytes
Binary file not shown.
-8.52 KB
Binary file not shown.

0 commit comments

Comments
 (0)