From 7c4ce19e6ea5e097a467f6f43b288257f91caba6 Mon Sep 17 00:00:00 2001 From: GamerBoss101 Date: Sat, 14 Sep 2024 13:52:28 -0400 Subject: [PATCH] Some Update --- README.md | 40 ++++------------------------------------ server/APISession.js | 44 -------------------------------------------- server/server.js | 4 ++++ 3 files changed, 8 insertions(+), 80 deletions(-) delete mode 100644 server/APISession.js diff --git a/README.md b/README.md index 5ce6766..bf2539a 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,6 @@ -# create-svelte +# Food Decisive -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). +## Description +This is a simple web application that helps users decide what to eat. The user can input their location and the type of food they are craving, and the app will return a list of restaurants that match the user's criteria. The user can then click on a restaurant to view more information about it, such as the restaurant's address, phone number, and website. The app also provides a map with directions to the restaurant. -## Creating a project - -If you're seeing this, you've probably already done this step. Congrats! - -```bash -# create a new project in the current directory -npm create svelte@latest - -# create a new project in my-app -npm create svelte@latest my-app -``` - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```bash -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -To create a production version of your app: - -```bash -npm run build -``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. +## Technologies Used diff --git a/server/APISession.js b/server/APISession.js deleted file mode 100644 index 95b0761..0000000 --- a/server/APISession.js +++ /dev/null @@ -1,44 +0,0 @@ - -export default class APISession { - - constructor() { - this.sessions = new Map(); - } - - generateSessionID() { - let id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); - return id; - } - - createSession(id) { - if(this.sessions.get(id)) return false; - this.sessions.set(id, this.generateSessionID()); - return this.sessions.get(id); - } - - getSession(id) { - for (let [key, value] in this.sessions) { - if (key == id) return value; - } - return null; - } - - setSession(id, value) { - if (!this.sessions.get(id)) return false; - this.sessions.set(id, value); - return true; - } - - getSessionUser(sessionValue) { - for (let [key, value] of this.sessions) { - if (value == sessionValue) return key; - } - return null; - } - - deleteSessionValue(id, key) { - if (!this.sessions.get(id)) return false; - this.sessions.delete(key); - return - } -} \ No newline at end of file diff --git a/server/server.js b/server/server.js index 407acc1..eb05b7a 100644 --- a/server/server.js +++ b/server/server.js @@ -17,6 +17,8 @@ const MongoServer = new Mongo(process.env.MONGO_URI); app.use(cors()); app.set("mongo", MongoServer); +let routePaths = []; + async function loadFolder(filePath) { let files = []; fs.readdirSync(filePath).forEach(file => { @@ -34,6 +36,7 @@ async function loadFiles(filePath) { if (file.default) { let route = new file.default(); app.use(route.path, route.getRouter()); + routePaths.push(route.path); console.log(`Loaded ${route.path}`); } } @@ -58,6 +61,7 @@ try { }, ms('1s')); } + server.listen(process.env.PORT, () => { console.log(`listening on port http://localhost:${process.env.PORT}`); });