Skip to content

Commit

Permalink
Merge pull request #26 from SpaghettiDB/update-api
Browse files Browse the repository at this point in the history
cors and query executer
  • Loading branch information
HudaSale7 authored Jun 15, 2024
2 parents b1912c5 + 7886f2d commit 453a084
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const port = 3000;
app.use(express.json());
app.use(
cors({
origin: ["http://localhost:3000", "http://localhost:5173"],
origin: true,
credentials: true,
})
);
Expand Down
6 changes: 6 additions & 0 deletions src/controllers/databaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ export const deleteDatabase = async (req, res) => {
.status(204)
.json({ message: "database deleted successfully" });
};

export const executeQuery = async(req, res) => {
const {dataName, query} = req.body
console.log(dataName, query)
res.send("")
}
2 changes: 2 additions & 0 deletions src/routes/databaseRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ route.delete(
control.deleteDatabase
);

route.post('/query', control.executeQuery)

export default route;

0 comments on commit 453a084

Please sign in to comment.