-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from MoazamAli45/fix-issue-26
Fix Issue #26
- Loading branch information
Showing
4 changed files
with
229 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
.env.production | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# VS Code | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
# IDEs and editors | ||
.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/ | ||
.history/ | ||
|
||
# MacOS | ||
.DS_Store | ||
|
||
# Windows | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Linux | ||
*~ | ||
|
||
# npm | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// server.js | ||
const express = require("express"); | ||
const app = express(); | ||
|
||
// Define the port | ||
const PORT = 3000; | ||
|
||
// Define a route | ||
app.get("/", (req, res) => { | ||
res.send("Hello, World!"); | ||
}); | ||
|
||
// Start the server | ||
app.listen(PORT, () => { | ||
console.log(`Server running at http://localhost:${PORT}/`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "api-gateway", | ||
"version": "1.0.0", | ||
"description": "Node Js Server", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"express": "^4.21.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,59 @@ | ||
- **api-gateway/**: | ||
- Example Project: A **RESTful API gateway** that supports user authentication and connects multiple services. | ||
- Ideal Contributions: Enhance the security with OAuth, add rate-limiting, or create sample client applications to demonstrate usage. | ||
# API Gateway | ||
|
||
This is a basic Node.js and Express.js server that responds with "Hello, World!". | ||
|
||
## Prerequisites | ||
|
||
- Node.js (v14 or higher) | ||
- npm (v6 or higher) | ||
|
||
## Installation | ||
|
||
1. Clone the repository: | ||
|
||
```sh | ||
git clone https://github.com/username/Hacktoberfest2024 | ||
cd api-gateway | ||
``` | ||
|
||
2. Install dependencies: | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
## Usage | ||
|
||
1. Start the server: | ||
|
||
```sh | ||
npm start | ||
``` | ||
|
||
2. Open your browser and navigate to `http://localhost:3000` to see the "Hello, World!" message. | ||
|
||
## Code Overview | ||
|
||
### `index.js` | ||
|
||
```javascript | ||
const express = require("express"); | ||
const app = express(); | ||
const port = 3000; | ||
|
||
app.get("/", (req, res) => { | ||
res.send("Hello, World!"); | ||
}); | ||
|
||
app.listen(port, () => { | ||
console.log(`Server is running at http://localhost:${port}`); | ||
}); | ||
``` | ||
|
||
## Contributing | ||
|
||
Feel free to submit issues and pull requests. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License. |