{"id":18773408,"url":"https://github.com/kleutons/node-do-zero","last_synced_at":"2026-04-13T13:02:59.409Z","repository":{"id":194205640,"uuid":"690090625","full_name":"kleutons/node-do-zero","owner":"kleutons","description":"Servidor NodeJs com fastify","archived":false,"fork":false,"pushed_at":"2023-09-12T16:53:50.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-29T21:41:01.289Z","etag":null,"topics":["express","nodejs","postgresql","sql","typescript"],"latest_commit_sha":null,"homepage":"https://kn-node-do-zero.onrender.com/","language":"TypeScript","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/kleutons.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-09-11T14:08:09.000Z","updated_at":"2023-09-21T17:29:02.000Z","dependencies_parsed_at":"2023-09-12T09:44:26.751Z","dependency_job_id":"5116d3d5-5cdc-471c-a0bd-76f4df944d2c","html_url":"https://github.com/kleutons/node-do-zero","commit_stats":null,"previous_names":["kleutons/node-do-zero"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kleutons/node-do-zero","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleutons%2Fnode-do-zero","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleutons%2Fnode-do-zero/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleutons%2Fnode-do-zero/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleutons%2Fnode-do-zero/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kleutons","download_url":"https://codeload.github.com/kleutons/node-do-zero/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleutons%2Fnode-do-zero/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31753551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["express","nodejs","postgresql","sql","typescript"],"created_at":"2024-11-07T19:33:53.975Z","updated_at":"2026-04-13T13:02:59.377Z","avatar_url":"https://github.com/kleutons.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Projeto Node do Zero Versão 18 \n1. Primeiro crie uma pasta para o seu projeto e acesse-a pelo terminal, exemplo:\n```dos\nmkdir node-do-zero\n```\n\n2. Inicialize um projeto Node.js executando:\nIsso criará um arquivo package.json com as informações do seu projeto.\n```npm\nnpm init -y\n```\n\n3. Crie uma pasta chamada ‘src’ e dentro  um arquivo JavaScript  (por exemplo, server.js) para iniciar seu servidor e importe o Express:\n\n```\nimport { createServer } from 'node:http'\nconst port = 3001; // Escolha a porta que desejar\n\nconst server = createServer((req, res) =\u003e {\n    console.log(`Servidor iniciado na porta ${port} http://localhost:${port}`);\n    res.write('Servidor iniciado');\n    return res.end();   \n})\n\nserver.listen(port);\n```\n\n4. Para iniciar o servidor, altere o package.json:\n```\n\"scripts\": {\n  ...\n  \"dev\": \"node --watch --no-warnings src/server.js\"\n  },\n```\n- Após isso Iniciar como desenvolvimento:\n\n```npm\nnpm run dev\n```\n\n## Instalando o fastify - Micro Framework\n```npm\nnpm i fastify\n```\n\n- Altere toda a configuração do arqivo server.js:\n```\nimport { fastify } from \"fastify\";\n\nconst server = fastify();\nconst port = 3001; // Escolha a porta que desejar\n\nserver.get('/', () =\u003e {\n    return 'Hello World'\n})\n\nserver.listen({\n    port: port\n}, () =\u003e {\n    console.log(`Servidor iniciado na porta ${port} Acesse: http://localhost:${port}`);\n})\n```\n\n## Usano Fastify com TypeScript:\n1. Crie um novo projeto npm, instale o Fastify e instale os tipos typescript e node.js como dependências de pares:\n```\nnpm init -y\nnpm i fastify\nnpm i -D typescript @types/node\n```\n\n2. Adicione as seguintes linhas à \"scripts\"seção do package.json:\n```\n{\n  \"scripts\": {\n    \"build\": \"tsc -p tsconfig.json\",\n    \"start\": \"node index.js\"\n  }\n}\n```\n\n3. Inicialize um arquivo de configuração TypeScript:\n```\nnpx tsc --init\n```\n\n4. Altere toda a configuração do arqivo server.ts:\n```\nimport { fastify } from \"fastify\";\n\nconst server = fastify();\nconst port = 3001; // Escolha a porta que desejar\n\nserver.get('/', () =\u003e {\n    return 'Hello World'\n})\n\nserver.listen({\n    port: port\n}, (err, address) =\u003e {\n    if (err) {\n        console.error(err)\n        process.exit(1)\n    }\n    console.log(`Servidor iniciado na porta ${port} Acesse: http://localhost:${port}`);\n})\n```\n\n5. Remover do package.json os type module, e mudar o run dev\n```\n  \"type\": \"module\", // remover\n   \"dev\": \"ts-node-dev src/server.ts\", // alterar\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkleutons%2Fnode-do-zero","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkleutons%2Fnode-do-zero","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkleutons%2Fnode-do-zero/lists"}