{"id":13487702,"url":"https://github.com/fomenyesu/egg-mongodb-example","last_synced_at":"2025-03-27T23:31:29.959Z","repository":{"id":94483083,"uuid":"87525870","full_name":"fomenyesu/egg-mongodb-example","owner":"fomenyesu","description":"a example of eggjs, mongodb, restful api and other stuff made it work...","archived":false,"fork":false,"pushed_at":"2020-02-18T14:55:11.000Z","size":443,"stargazers_count":125,"open_issues_count":2,"forks_count":34,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-30T23:35:32.106Z","etag":null,"topics":["egg-mongodb","egg-plugin","eggjs-example","eggjs-mongodb-example"],"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/fomenyesu.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}},"created_at":"2017-04-07T08:54:15.000Z","updated_at":"2024-08-29T08:16:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"bb323395-5377-435a-8c11-62e7bb4d5b32","html_url":"https://github.com/fomenyesu/egg-mongodb-example","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/fomenyesu%2Fegg-mongodb-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fomenyesu%2Fegg-mongodb-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fomenyesu%2Fegg-mongodb-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fomenyesu%2Fegg-mongodb-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fomenyesu","download_url":"https://codeload.github.com/fomenyesu/egg-mongodb-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245944019,"owners_count":20697944,"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":["egg-mongodb","egg-plugin","eggjs-example","eggjs-mongodb-example"],"created_at":"2024-07-31T18:01:02.412Z","updated_at":"2025-03-27T23:31:29.582Z","avatar_url":"https://github.com/fomenyesu.png","language":"JavaScript","funding_links":[],"categories":["Applications","应用"],"sub_categories":["插件"],"readme":"# egg-mongodb-example\na example of eggjs, mongodb, restful api and other stuff made it work...\n\n# Examples for [egg](https://github.com/eggjs/egg/)\n\n## Usage\n\nmake sure you nodejs version \u003e7.0\ninstall mongodb\nstart mongodb\nimport data.json to mongodb\n  1. create Collection: \"web_admin\" \"web_news\" \"web_newsType\" \"IdGenerator\"\n  2. create Documents in data.json\nrun npm to start server\n  npm start\n\n```bash\n$ npm install\n$ npm start\n```\n\n## REST API Example\n\nFollow the naming conventions of rails:\n\nmethod     | url                                                    | file path               | controller name\n---        | ---                                                    | ---                     | ---\n**GET**    | `/api/{objects}[?per_page={per_page}\u0026page={page}]` | `app/controller/{objects}.js` | **index()**\n**GET**    | `/api/{objects}/:id`                               | `app/controller/{objects}.js` | **show()**\n**POST**   | `/api/{objects}`                                   | `app/controller/{objects}.js` | **create()**\n**PUT**    | `/api/{objects}/:id`                               | `app/controller/{objects}.js` | **update()**\n**DELETE** | `/api/{objects}/:id[s]`                            | `app/controller/{objects}.js` | **destroy()**\n\n\napi/users GET List\n\n```javascript\n{\n\"meta\":{\"total\":3},\n\"data\":[\n{\"_id\":\"58d8a899f5f2486f1f6d4236\",\"uid\":1,\"name\":\"admin\",\"pass\":\"123\",\"status\":1,\"time\":\"1325472736\"},\n{\"_id\":\"58db7828a14b14815447cf33\",\"name\":\"sdf\",\"pass\":\"123\",\"status\":1,\"time\":\"1325472736\",\"uid\":3,\"__v\":0},\n{\"_id\":\"58db7d3bcee4d48df6f5bdfd\",\"name\":\"sdddf\",\"pass\":\"123\",\"status\":1,\"time\":\"1325472736\",\"uid\":4,\"__v\":0}\n]\n}\n```\n\napi/users/1 GET Single Data\n\n```javascript\n{\n\"meta\":{\"total\":1},\n\"data\":[\n{\"_id\":\"58d8a899f5f2486f1f6d4236\",\"uid\":1,\"name\":\"admin\",\"pass\":\"123\",\"status\":1,\"time\":\"1325472736\"}\n]\n}\n```\n\napi/users/2 PUT Update data with uid\n\n```javascript\n{\"name\":\"admin123\",\"pass\":\"123\",\"status\":1,\"time\":\"1325472736\"}\n```\n\napi/users POST insert data\n\n```javascript\n{\"name\":\"admin123\",\"pass\":\"123\",\"status\":1,\"time\":\"1325472736\"}\n```\n\nsame with news and news_type for rest api data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffomenyesu%2Fegg-mongodb-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffomenyesu%2Fegg-mongodb-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffomenyesu%2Fegg-mongodb-example/lists"}