From 7452ea6b1dd91d5e0c6269534ddda32e76cb5beb Mon Sep 17 00:00:00 2001 From: Ibrahim Raimi Date: Mon, 23 Jan 2023 10:41:22 +0100 Subject: [PATCH 1/3] renamed: db.json -> json/db.json --- db.json => json/db.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db.json => json/db.json (100%) diff --git a/db.json b/json/db.json similarity index 100% rename from db.json rename to json/db.json From 0454ca0dc521091b27bc75f330388d6202337ae2 Mon Sep 17 00:00:00 2001 From: Ibrahim Raimi Date: Mon, 23 Jan 2023 10:42:40 +0100 Subject: [PATCH 2/3] refactor: update code structure to es6 --- index.js | 23 +++++++++++------------ package.json | 1 + 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index 7831f1a..c3c6af5 100644 --- a/index.js +++ b/index.js @@ -1,20 +1,19 @@ -const express = require("express"); -const app = express(); -const fs = require("fs"); +import express from "express"; +import fs from "fs"; -const database = fs.readFileSync("db.json"); +const app = express(); +const PORT = process.env.PORT || 3000; +const database = fs.readFileSync("./json/db.json"); const db = JSON.parse(database); -console.log(db); app.get("/", (req, res) => { - res.send(db); + res.send(db); }); app.get("/ping", (req, res) => { - res.sendStatus(200); -}) - + res.sendStatus(200); +}); -app.listen(3000, () => { - console.log("Server running on port 3000"); -}); \ No newline at end of file +app.listen(PORT, () => { + console.log("Server running on port 3000"); +}); diff --git a/package.json b/package.json index 78c6f1f..94f9944 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "mbtdb", "version": "1.0.0", "main": "index.js", + "type": "module", "description": "A database of Main Battle Tanks", "license": "MIT", "dependencies": { From f5cc49d727f954fb157d74acdef2c7a4de311c6b Mon Sep 17 00:00:00 2001 From: Ibrahim Raimi Date: Mon, 23 Jan 2023 10:43:09 +0100 Subject: [PATCH 3/3] docs: update documentation --- README.md | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/README.md b/README.md index 45cb3b4..c45e8e8 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,26 @@ # MDTDb - A database of Main Battle Tanks - - +A database of Main Battle Tanks ![GitHub repo size](https://img.shields.io/github/repo-size/n3-rd/mbtdb) ![Lines of code](https://img.shields.io/tokei/lines/github/n3-rd/mbtdb) ![GitHub repo file count](https://img.shields.io/github/directory-file-count/n3-rd/mbtdb) ![GitHub last commit](https://img.shields.io/github/last-commit/n3-rd/mbtdb) ![GitHub stars](https://img.shields.io/github/stars/n3-rd/mbtdb?style=social) - - ## Live version - - [live version is here](https://inspolist.netlify.app/) - - ## Feedback and Bugs - - If you have any feedback or bug report, please feel free to raise an issue :) - - ## Contributing - - If you would like to contribute to this amazing project, you can create a Pull Request containing your proposed changes and we will review it. Please check our [contributing guildelines](CONTRIBUTING.md) first. Thank you. - - ## Contributors - - ![GitHub Contributors Image](https://contrib.rocks/image?repo=n3-rd/mbtdb) - - ## Donate - - Buy Me A Coffee \ No newline at end of file