{"id":24607328,"url":"https://github.com/yogithesymbian/api-nodejs-sequalize-mysql-2021","last_synced_at":"2026-04-07T23:31:14.308Z","repository":{"id":106061212,"uuid":"406567988","full_name":"yogithesymbian/api-nodejs-sequalize-mysql-2021","owner":"yogithesymbian","description":"API - NodeJS express sequalize","archived":false,"fork":false,"pushed_at":"2022-04-12T11:50:42.000Z","size":1705,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T11:25:32.281Z","etag":null,"topics":["api","express","nodejs","sequalize"],"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/yogithesymbian.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-09-15T01:00:57.000Z","updated_at":"2022-04-09T22:15:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"4e0c7ba9-27bc-42af-b514-fef7e11010f3","html_url":"https://github.com/yogithesymbian/api-nodejs-sequalize-mysql-2021","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yogithesymbian/api-nodejs-sequalize-mysql-2021","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogithesymbian%2Fapi-nodejs-sequalize-mysql-2021","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogithesymbian%2Fapi-nodejs-sequalize-mysql-2021/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogithesymbian%2Fapi-nodejs-sequalize-mysql-2021/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogithesymbian%2Fapi-nodejs-sequalize-mysql-2021/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yogithesymbian","download_url":"https://codeload.github.com/yogithesymbian/api-nodejs-sequalize-mysql-2021/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogithesymbian%2Fapi-nodejs-sequalize-mysql-2021/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31533823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["api","express","nodejs","sequalize"],"created_at":"2025-01-24T17:36:16.751Z","updated_at":"2026-04-07T23:31:14.288Z","avatar_url":"https://github.com/yogithesymbian.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# api-nodejs-sequalize-mysql-2021\n[![License](https://poser.pugx.org/laravel/lumen-framework/license.svg)](https://github.com/yogithesymbian)\n1. https://github.com/yogithesymbian/nodeJS-jwt-auth-sequalize-mysql [ deprecated ]\n2. https://github.com/yogithesymbian/api-nodejs-sequalize-mysql-2021 [ deprecated ]\n3. todo auto generator crud , auto route , and other automatic soon\n\n\n### swagger\n![resources/static/assets/uploads/swagger1.png](/resources/static/assets/uploads/swagger1.png)\n![resources/static/assets/uploads/swagger2.png](/resources/static/assets/uploads/swagger2.png)\n\n\n```\ngit clone https://github.com/yogithesymbian/api-nodejs-sequalize-mysql-2021.git\n```\n----\n1. `cd api-nodejs-sequalize-mysql-2021`\n2. `nsc-migrates`\n3. `npm run dev`\n-----\n\n### database configuration\n- `./app/config/config.json`\n\n### port listening\n`const PORT = process.env.PORT || 3001;`\n### cors\n`var corsOptions = {\n  origin: \"http://localhost:3001\",\n};`\n\n## endpoint\n`/api/auth/signup`\n\n```\nraw json\n{\n    \"username\": \"yogiarifwidodo\",\n    \"email\": \"yogiarifwidodo@yogi.com\",\n    \"password\": \"yogi\",\n    \"roles\": [\n        \"moderator\",\n        \"user\"\n    ]\n}\n```\n\n`/api/auth/signin`\n\n```\nraw json\n{\n    \"username\": \"yogiarifwidodo\",\n    \"password\": \"yogi\"\n}\n```\n\n1. `/api/test/all` public access\n2. `/api/test/user` user access\n3. `/api/test/mod` moderator access\n4. `/api/test/admin` admin access\n\n----\n`x-access-token :` `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiaWF0IjoxNjA2MDE1NjU5LCJleHAiOjE2MDYxMDIwNTl9.pUya-Wqm8sVmadkxfGvYL7N0Y3d-18dT3IaZtSLUMS4`\n\n# SET UP SERVER\n## Aliyun Linux Server | HTTPD/APACHE\n```\n#/etc/systemd/system/node-app-1.service\n\nDescription = node-app-1.service\nAfter network.target = node-app-1.service\n\n[Service]\nExecStart=/usr/local/bin/npm run dev /var/www/html/api/nodejs/api-doa-nodeJS-express-mysql/server.js\nRestart=on-failure\nStandardOutput=syslog\nStandardError=syslog\n\nSyslogIdentifier=node-app-1\nUser=nobody\nGroup=root\n\nEnvironment=NODE_ENV=production PORT=3000\nWorkingDirectory=/var/www/html/api/nodejs/api-doa-nodeJS-express-mysql\n\n[Install]\nWantedBy=multi-user.target\n```\n\nThen run the following to start both instances of our node application\n\n`$ systemctl start node-app-1`\nThe first instance will be accepting requests at port 5000, where as the other one at port 5001. If any of them crashes it will automatically be restarted.\n\nTo make your node app instances run when the server starts do the following\n\n`$ systemctl enable node-app-1`\nIn case there are problems with any of the following commands above you can use any of these two:\n\n```\n$ sudo systemctl status node-app-1\n$ sudo journalctl -u node-app-1\n```\n\nThe first line will show your app instance current status and whether it is running. The second command will show you all logging information including output on standard error and standard output streams from your instance.\n\nUse the first command right now to see whether your app is running or whether there has been some problem starting it.\n\nRe-deploying your app\nWith the current setup, if we have some new application code in our repository, all you have to do is the following\n\n```\ncd /opt/app\ngit pull\nsudo systemctl restart node-app-1\n```\n## firewall\n```\nsudo ufw allow 3000 // execute to allow on port\nsudo ufw status verbose // status\n```\n\n## HEROKU\n\nStart your app locally using the heroku local command, which is installed as part of the Heroku CLI.\n`heroku local web`\n\n```\n/node_modules\nnpm-debug.log\n.DS_Store\n/*.env\n```\n\nDeploy your application to Heroku\nAfter you commit your changes to git, you can deploy your app to Heroku.\n\n```\ngit add .\ngit commit -m \"Added a Procfile.\"\nheroku login\nEnter your Heroku credentials.\n...\nheroku create\nCreating arcane-lowlands-8408... done, stack is cedar\nhttp://arcane-lowlands-8408.herokuapp.com/ | git@heroku.com:arcane-lowlands-8408.git\nGit remote heroku added\ngit push heroku master\n...\n-----\u003e Node.js app detected\n...\n-----\u003e Launching... done\n       http://arcane-lowlands-8408.herokuapp.com deployed to Heroku\n```\n\n\n---\n\n## modification guide\n1. make a model, and register the model into `/app/models/index.js`.\n- `deprecated : use new modification guide to create a model `\n2. create a controller (for consuming in routes on laters).\n3. create routes in `/app/routes` and register the routes in `/server.js` .\n\n\n## new modification guide note list short command\n------\n1. `npm install --save sequelize`\n2. `npm install --save-dev sequelize-cli`\n3. `npm sequelize-cli init`\n4. `npm install mysql2`\n-------\n1. `npx sequelize-cli model:generate --name user --attributes first_name:string,last_name:string,email:string`\n-------\n1. `npx sequelize-cli db:migrate`\n2. `npx sequelize-cli db:migrate:undo`\n3. `npx sequelize-cli db:migrate:undo:all --to XXXXXXXXXXXXXX-create-posts.js`\n-------\n1. `npx sequelize-cli seed:generate --name demo-user`\n2. `npx sequelize-cli db:seed:all`\n3. `npx sequelize-cli db:seed:undo`\n4. `npx sequelize-cli db:seed:undo --seed name-of-seed-as-in-data`\n5. `npx sequelize-cli db:seed:undo:all`\n-------\n\n### skeleton migration only\n1. `npx sequelize-cli migration:generate --name migration-skeleton`\n\n## using snippet\nfor snippet just type the folder name first to trigger what for todo for example if you are in `auth.controller` we already known the folder is `controllers` so just type `cont` will trigger what todo.\n\n\n## aliases .zsrhc | .bshrc\n```\nalias nsc=\"npx sequelize-cli\"\n\u003c!-- FOR MODEL --\u003e\nalias nsc-m-generate=\"npx sequelize-cli model:generate --name\"\nalias nsc-migrate=\"npx sequelize-cli db:migrate\"\nalias nsc-migrateu=\"npx sequelize-cli db:migrate:undo:all\"\n\n\u003c!-- FOR SEEDER --\u003e\nalias nsc-s-generate=\"npx sequelize-cli seed:generate --name\"\nalias nsc-seeder=\"npx sequelize-cli db:seed:all\"\nalias nsc-seederu=\"npx sequelize-cli db:seed:undo:all\"\n\n\u003c!-- FOR RE-MIGRATE WITH SEEDER GENERATE ALL --\u003e\nalias nsc-migrates=\"nsc-migrateu \u0026\u0026 nsc-migrate \u0026\u0026 nsc-seeder\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogithesymbian%2Fapi-nodejs-sequalize-mysql-2021","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyogithesymbian%2Fapi-nodejs-sequalize-mysql-2021","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogithesymbian%2Fapi-nodejs-sequalize-mysql-2021/lists"}