{"id":20444868,"url":"https://github.com/celeroncoder/summerfest-gdsc-session-setup_part","last_synced_at":"2026-06-07T15:31:32.810Z","repository":{"id":160502145,"uuid":"635384501","full_name":"celeroncoder/summerfest-gdsc-session-setup_part","owner":"celeroncoder","description":"GDSC VIT Bhopal Chapter's Summerfest'23 Web Team Sessions's API Development Setup Part","archived":false,"fork":false,"pushed_at":"2023-05-02T18:33:17.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-15T21:28:41.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gdsc-summerfest-api.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/celeroncoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-02T15:21:58.000Z","updated_at":"2023-05-02T18:03:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7b1fec4-ce04-4b3a-ae61-efd3741a7a96","html_url":"https://github.com/celeroncoder/summerfest-gdsc-session-setup_part","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celeroncoder%2Fsummerfest-gdsc-session-setup_part","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celeroncoder%2Fsummerfest-gdsc-session-setup_part/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celeroncoder%2Fsummerfest-gdsc-session-setup_part/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celeroncoder%2Fsummerfest-gdsc-session-setup_part/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/celeroncoder","download_url":"https://codeload.github.com/celeroncoder/summerfest-gdsc-session-setup_part/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241992846,"owners_count":20054410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T10:09:29.499Z","updated_at":"2025-12-02T16:03:49.350Z","avatar_url":"https://github.com/celeroncoder.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Setup\n\nTo setup the express application on the backend, here’s what you want:\n\n### Installing Tools\n\n---\n\n- NodeJS\n  Install Nodejs from the [official website](https://nodejs.org). After you’re done installing validate the installation by the following command:\n  ```bash\n  node -v\n  // and\n  npm -v\n  ```\n  These should output some version no. like 1.0.0 or something similar\n\n## Creating the project\n\n### Initialize the project\n\n---\n\nSo everything in a node is a package or it has to be to install or use other available package (other than the default ones). So we first have to initialize our project folder as package.\n\n```bash\n// creating the folder\nmkdir nodejs-express\n// initializing the project\nnpm init -y\n```\n\n\u003e 💡 We added a `-y` flag in there to avoid all those questions and edit the config in the editor.\n\nNow that you’ve created a folder and initialized it let’s open it in your favorite code-editor.\n\n### Installing Packages\n\n---\n\nSo we’re going to install the most essential package i.e. `express` required in the project, we may need more as we’re developing the application but these are like the bare bones one so we’re going to install them in the start.\n\n```bash\ncd nodejs-express\nnpm install express\n```\n\n### Creating the basic API\n\n---\n\n- Create a new file in the folder called `main.js`, you can call it anything you want, just don’t go crazy with names!\n- Paste the following code in the file:\n\n  ```jsx\n  const express = require(\"express\");\n\n  const app = express();\n\n  app.get(\"/\", function (req, res) {\n    return res.send({ message: \"Hello World!!!!!!!!!!\" });\n  });\n\n  app.listen(8000, () =\u003e console.log(\"The server started at port 8000\"));\n  ```\n\n- Here’s the explanation for the above code\n  - In the first line, we `require` the project into the file, so that we can use it. We do this by using the built in `require` function and passing in the name of the package, i.e. `express` in this case. We store the result of the function that’s the `express object`in a constant named `express` for simplicity.\n  - Then we create an instance of the express application by calling the `express()`function and storing that in the `app` variable.\n  - Now, that we have our app crated, we need to create some routes to send some data to the user when called. So we define this `app.get()`function which corelates to the `GET` http request. We pass in two arguments, first is the route, i.e. `“/”` the root route, and then we pass in a function to handle that request.\n  - The function has two arguments that has to be given to it, `req` and `res`. They are the Request and Response objects respectively.\n  - Then, inside the function body we return `res.send()`which sends some data to the user. It can be anything, a string, an object, or a static file.\n  - Now at the end, we make the app listen to a specific port, i.e. `8000` and also pass a callback function to indicate that the app is listening.\n\n### Running the App\n\n---\n\nNow we can run the application as:\n\n```bash\nnode ./main.js\n```\n\nOr we can write a script for it in the `package.json` file and run it like `npm run start`\n\n```json\n// package.json\n{\n\t...\n\tscripts: {\n\t\tstart: \"node ./main.js\"\n\t}\n\t...\n}\n```\n\n### Adding `nodemon`\n\n---\n\nYou may have noticed that the current setup is not much developer friendly, every time you change something in the application, you have to rerun the `start` command to reflect those changes.\n\nThis is very tiring so what we can do is use a package like `nodemon` that watches the files in the project and rerun the server for us every time the files change.\n\nSo here’s how you install\n\n```bash\nnpm install nodemon --save-dev\n```\n\n\u003e 💡 We added the `--save-dev` flag in the above install command to save the package as a developer dependency. `nodemon` is a developer dependency because we only need it while developing the project, once the application is deployed I think we’re not going to use it.\n\n\u003e And saving it as a developer dependency, it won’t get installed in the deployment process which will speed up the installation.\n\nand you can create a sperate script for running it in development as\n\n```json\n// package.json\n{\n\t...\n\tscripts: {\n\t\t\"start\": \"node ./main.js\",\n\t\t\"dev\": \"nodemon ./main.js\",\n\t}\n\t...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceleroncoder%2Fsummerfest-gdsc-session-setup_part","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fceleroncoder%2Fsummerfest-gdsc-session-setup_part","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceleroncoder%2Fsummerfest-gdsc-session-setup_part/lists"}