Skip to content

Commit

Permalink
Merge pull request #168 from agiledev-students-fall2023/sprint/2/spik…
Browse files Browse the repository at this point in the history
…e/167/backend-src-directories

Sprint/2/spike/167/backend src directories
  • Loading branch information
hasiburratul authored Nov 3, 2023
2 parents 838d2ba + a94822f commit 0dea2d1
Show file tree
Hide file tree
Showing 7 changed files with 286 additions and 313 deletions.
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
"editor.formatOnPaste": false, // required
"editor.formatOnType": false, // required
"editor.formatOnSave": true, // optional
"editor.formatOnSaveMode": "file", // required to format on save
"files.autoSave": "onFocusChange", // optional but recommended
"vs-code-prettier-eslint.prettierLast": "false" // set as "true" to run 'prettier' last not first
}
12 changes: 6 additions & 6 deletions back-end/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import express from "express"; // ESM import style!
import morgan from "morgan";
import cors from "cors";
import url from 'url';
import path from 'path';
import url from "url";
import path from "path";
// import multer from "multer"; - configure when required

const app = express(); // instantiate an Express object
Expand All @@ -24,7 +24,7 @@ app.use(cors());

// serve static files from the public folders
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, "public")));

// parse JSON in the request body
app.use(express.json());
Expand All @@ -39,13 +39,13 @@ app.use(morgan("dev"));

// testing function
app.get("/", (req, res) => {
res.send("Hello!");
res.send("Hello!");
});

// testing cross origin requests - login username and password
app.post("/api/student/login", (req, res) => {
console.log(req.body);
res.send("Hello!1");
console.log(req.body);
res.send("Hello!1");
});

// export the express app we created to make it available to other modules
Expand Down
Loading

0 comments on commit 0dea2d1

Please sign in to comment.