{"id":22221254,"url":"https://github.com/victorbadaro/node-api-rawsql-example","last_synced_at":"2025-03-25T07:42:44.822Z","repository":{"id":45279747,"uuid":"441204877","full_name":"victorbadaro/node-api-rawsql-example","owner":"victorbadaro","description":"An example NodeJS API that uses raw SQL","archived":false,"fork":false,"pushed_at":"2023-08-22T02:54:53.000Z","size":78,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T07:13:50.011Z","etag":null,"topics":["api","api-rest","backend","node","postgres","raw-sql","sql"],"latest_commit_sha":null,"homepage":"","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/victorbadaro.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":"2021-12-23T14:27:30.000Z","updated_at":"2025-01-01T06:39:05.000Z","dependencies_parsed_at":"2024-12-03T03:03:53.540Z","dependency_job_id":null,"html_url":"https://github.com/victorbadaro/node-api-rawsql-example","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadaro%2Fnode-api-rawsql-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadaro%2Fnode-api-rawsql-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadaro%2Fnode-api-rawsql-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadaro%2Fnode-api-rawsql-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victorbadaro","download_url":"https://codeload.github.com/victorbadaro/node-api-rawsql-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245422921,"owners_count":20612725,"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":["api","api-rest","backend","node","postgres","raw-sql","sql"],"created_at":"2024-12-02T23:12:51.977Z","updated_at":"2025-03-25T07:42:44.783Z","avatar_url":"https://github.com/victorbadaro.png","language":"JavaScript","readme":"# node-api-rawsql-example\r\n\r\n[![LEIAME.md](https://img.shields.io/badge/-Leia%20em%20Portugu%C3%AAs-brightgreen?style=for-the-badge)](./LEIAME.md)\r\n\r\n## Summary\r\n- [🧾 About](#-about)\r\n- [🚀 Main technologies](#-main-technologies)\r\n- [💻 Usage](#-usage)\r\n- [👌 Requests](#-requests)\r\n\r\n## 🧾 About\r\nThis project was made to be a simple example of a back-end application using raw SQL (no ORMs or Query builders)\r\n\r\n## 🚀 Main technologies\r\n- [Node.js](https://nodejs.org/)\r\n- [Express](https://expressjs.com/)\r\n- [PostgreSQL](https://www.postgresql.org/)\r\n- [Babel](https://babeljs.io/)\r\n- [Nodemon](https://nodemon.io/)\r\n\r\n_(You can see all the dependencies in the [package.json](./package.json) file)_\r\n\r\n## 💻 Usage\r\nAs you can see on [🚀 Main technologies](#-main-technologies) topic, this application depends on a postgreSQL database, so you must have it installed.\r\nFirst things first:\r\n\r\n1. Clone the project (you'll need a [personal access token](https://docs.github.com/pt/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls)):\r\n   ```bash\r\n   $ git clone https://github.com/victorbadaro/node-api-rawsql-example.git\r\n   ```\r\n\r\n2. Access its directory:\r\n   ```bash\r\n   $ cd node-api-rawsql-example\r\n   ```\r\n\r\n3. Install its dependencies:\r\n   ```bash\r\n   $ yarn\r\n   # feel free to use another package manager, but you might want use yarn once there's already a yarn.lock file in the root directory\r\n   ```\r\n\r\n4. Access your PostgreSQL server and create the database (you can use any name):\r\n   ```sql\r\n   CREATE DATABASE node_api_rawsql_db;\r\n   ```\r\n\r\n5. Run the SQL commands that is in [database.sql](./database.sql) file\r\n6. Create a `.env` file in the root directory with the same content that is in the [.env.example](./.env.example) file and fill the variables with your own data:\u003cbr /\u003e\r\n   For example:\u003cbr /\u003e\r\n   ![image](https://github.com/victorbadaro/node-api-rawsql-example/assets/9096344/4948c4e7-aaf1-4134-bf7b-d1c7fc280f60)\r\n\r\n7. Start the server by running the `dev` script:\r\n   ```bash\r\n   yarn dev\r\n   ```\r\n\r\n## 👌 Requests\r\nNow the server is ready to receive your requests! There's a [request collection](./request_collection.json) in the root directory so you can use (use [insomnia](https://insomnia.rest/) to import the collection). Remember to inform the server port in the `baseUrl` environment variable!\u003cbr /\u003e\r\nHere are the requests you can make:\r\n\r\n- GET /users\r\n- POST /users\r\n  ```json\r\n  {\r\n    \"name\": \"\",\r\n    \"email\": \"\"\r\n  }\r\n  ```\r\n- GET /users/:id\r\n- PUT /users/:id\r\n  ```json\r\n  {\r\n    \"name\": \"\",\r\n    \"email\": \"\"\r\n  }\r\n  ```\r\n- DELETE /users/:id\r\n\r\n- GET /products\r\n- POST /products\r\n  ```json\r\n  {\r\n    \"description\": \"\",\r\n    \"user_id\": \r\n  }\r\n  ```\r\n- GET /products/:id\r\n- PUT /products/:id\r\n  ```json\r\n  {\r\n    \"description\": \"\" \r\n  }\r\n  ```\r\n- DELETE /products/:id\r\n\r\n---\r\n\r\n\u003cp align=\"center\"\u003eThis project was created and developed with ❤ by \u003ca href=\"https://github.com/victorbadaro\"\u003eVictor Badaró\u003c/a\u003e\u003c/p\u003e\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorbadaro%2Fnode-api-rawsql-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorbadaro%2Fnode-api-rawsql-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorbadaro%2Fnode-api-rawsql-example/lists"}