{"id":15402174,"url":"https://github.com/liby99/nodejs_server","last_synced_at":"2025-03-14T17:25:13.613Z","repository":{"id":75877315,"uuid":"49533940","full_name":"Liby99/Nodejs_Server","owner":"Liby99","description":null,"archived":false,"fork":false,"pushed_at":"2016-02-06T22:47:23.000Z","size":774,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-21T10:51:04.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Liby99.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}},"created_at":"2016-01-12T22:45:21.000Z","updated_at":"2016-01-16T01:56:16.000Z","dependencies_parsed_at":"2023-04-28T11:34:36.787Z","dependency_job_id":null,"html_url":"https://github.com/Liby99/Nodejs_Server","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/Liby99%2FNodejs_Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liby99%2FNodejs_Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liby99%2FNodejs_Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liby99%2FNodejs_Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Liby99","download_url":"https://codeload.github.com/Liby99/Nodejs_Server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243616986,"owners_count":20319987,"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-10-01T16:01:21.933Z","updated_at":"2025-03-14T17:25:13.592Z","avatar_url":"https://github.com/Liby99.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nodejs_Server\n\nA self-written Node.js Server Application. \n\n# Introduction\n\nNote: The Application is written integrating the file structure. So do not change the name of server files or path names.\n\nTo Start running the server after installed node.js, open terminal, go to /server directory, and run:\n\n    $ node index.js\n    \nThen you will see a log\n\n    Server now running on port 8080\n\nTo change the port, go to /server/data/config.js\nAnd change the port entry to the port you want.\n\nTo connect to your mysql database, also go to /server/data/config.js\nAnd change the corresponding\n\n    mysql_username\n    \n    mysql_password\n    \n    mysql_database\n    \nSo that you will successfully connect to your database\n\n# Samples\n\nThere are several samples in the published files:\n\nThe front end files: \n\n    /index.html\n    \n    /css/basic.css\n    \n    /js/basic.js\n\nThe back end files:\n\n    /handler/comment.js\n    \n    /server/module/comment.js\n    \n    /server/module/user.js\n    \nHope you can know how to use the server application through these files.\n\n# Note for Get/Post AJAX Requests\n\nFrom the client Javascript, you need to request the url: \n\n    /ajax/[target]?action=[data]\n\nWhere the [target] should not contain any extension names. (And [data] follows the original structure.)\nContaining \u003ccode\u003eaction\u003c/code\u003e is easy for the handler to recognize what thing it needs to do.\n\n# Paths\n\n\u003ccode\u003e/\u003c/code\u003e\nStore .html pages.\n\n\u003ccode\u003e/css\u003c/code\u003e\nStore .css stylesheets. Could be accessed by anyone\n\n\u003ccode\u003e/js\u003c/code\u003e\nStore client .js scripts. Could be accessed by anyone\n\n\u003ccode\u003e/img\u003c/code\u003e\nStore basic images\n\n\u003ccode\u003e/fonts\u003c/code\u003e\nStore fonts\n\n\u003ccode\u003e/handler\u003c/code\u003e\nStore handler for get/post requests. Couldn't be accessed by client. \n\n\u003ccode\u003e/server\u003c/code\u003e\nThe Place storing server scripts. Couldn't be accessed by client.\n\n\u003ccode\u003e/server/index.js\u003c/code\u003e\nThe main server script to be run by \n  \u003ccode\u003e$ node index.js\u003c/code\u003e\nDistributes the request to corresponding part of handling\n\n\u003ccode\u003e/server/file.js\u003c/code\u003e\nIf the request is for certain files, the request will be distributed here. \nWill read the code config so that the user will get 403 Forbidden for requesting forbidden files. \nIf there's no such files, the user will get 404 Not Found. \n\n\u003ccode\u003e/server/ajax.js\u003c/code\u003e\nThe script that handles the ajax get/post requests. Distribute the requests to ~/handler directory. \n\n\u003ccode\u003e/server/request.js\u003c/code\u003e\nThe script encapsulates the method for getting post body data. \nNote: Should be able to discriminate malevolence post.\n\n\u003ccode\u003e/server/response.js\u003c/code\u003e\nThe script encapsulates the method for standardizing response data, including error_code, error_log, content\n\n\u003ccode\u003e/server/mysql.js\u003c/code\u003e\nThe script encapsulates the methods for making connection to mysql database (reading the config files), \nquery and execute\n\n\u003ccode\u003e/server/data/\u003c/code\u003e\nStores data files, including the path authentication, http port, mysql connection config, and http return type. \n\n\u003ccode\u003e/server/data/path.js\u003c/code\u003e\nIf the entry gets value 0, it means that this path could be accessed by client\nOtherwise cannot.\n\n\u003ccode\u003e/server/module/\u003c/code\u003e\nThe place storing encapsulated object-oriented classes. \n\n\u003ccode\u003e/server/node_modules/\u003c/code\u003e\nThe place storing npm (nodejs package manager) installed libraries.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliby99%2Fnodejs_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliby99%2Fnodejs_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliby99%2Fnodejs_server/lists"}