{"id":18337723,"url":"https://github.com/moosend/import-service-plugin-starter-pack","last_synced_at":"2025-04-09T20:18:26.025Z","repository":{"id":69562924,"uuid":"61143439","full_name":"moosend/import-service-plugin-starter-pack","owner":"moosend","description":"A starter pack for making plugin s in Node/Typescript for the moosend import service","archived":false,"fork":false,"pushed_at":"2016-06-22T16:07:19.000Z","size":267,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-09T20:18:23.652Z","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/moosend.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":"2016-06-14T17:46:34.000Z","updated_at":"2016-06-14T17:53:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"4791c21e-5bf2-4e84-87a7-df5740d01c15","html_url":"https://github.com/moosend/import-service-plugin-starter-pack","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/moosend%2Fimport-service-plugin-starter-pack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosend%2Fimport-service-plugin-starter-pack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosend%2Fimport-service-plugin-starter-pack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosend%2Fimport-service-plugin-starter-pack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moosend","download_url":"https://codeload.github.com/moosend/import-service-plugin-starter-pack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103910,"owners_count":21048246,"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-11-05T20:12:07.321Z","updated_at":"2025-04-09T20:18:26.006Z","avatar_url":"https://github.com/moosend.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  import-service-plugin-starter-pack\n\u003eStarter pack for a Node/Express based plugin for the Moosend import service\n\nThis is a node/express based starter pack for those who want to develop plugins for Moosend import service using Node, Express and Typescript. Before we continue with the explanation please read the [Import Service documentation](http://www.google.com) first, because without that this starter pack has no meaning, it is very easy to undestand. The starter pack includes a project structure, setups and commands for typescript tasks like compilation and errors, tesing framework and testing commands for mocha and the necessary infrastructure and clearly defined Typesript interfaces for the data required by the Moosend import service as defined the in its documentation. All of this is explained in more detail below.\n\n\n### Initialization\n\nPlease use the following command to install all local dependencies:\n````\nnpm install\n````\nPlease use the following command to install Typescript declaration files:\n````\ntypings install\n````\nThe server machine must also have typescript installed globally:\n````\nnpm install -g typescript\n````\n\n\n### Available npm commands\n\nTo start the ts watcher and express server concurrently run the command below. This should be done only for development. You can also run 'npm run ts-watch' and 'npm run server-dev' in two separate terminal windows it has the same effect.\n````\nnpm run start-dev\n````\n\nTo build the project for production and start the server for production(meaning production config will be used)\n````\nnpm run deploy\n````\n\nTo run the test suite without generating a coverage report\n````\nnpm test\n````\n\nTo run the test suite and generate a coverage report\n````\nnpm run test-coverage\n````\n\n\nTo build the project for development and start a development server that watches for changes in JS code\n````\nnpm run server-dev\n````\n\nTo start in debugging mode\n````\nnpm run debug\n````\n\n To generate apidocs \n````\nnpm run generate-apidoc\n````\n\nTo build the project(transpile typescript into JS in the dist folder)\n````\nnpm run build\n````\n\n\nTo watch for changes during development in typescript\n````\nnpm run ts-watch\n````\n\n## Structure\n### Config\nConfig files for each environment are located in the config folder. project config uses the [node-config](https://github.com/lorenwest/node-config) package. The json files located here correspond with the current environment.\n\n### Source files\nAll project source typescript files are located in the 'src' folder, so you will be mostly working there.\n\n#### 'data' folder\nThe 'data' folder contains all the interfaces and classes necessary as they are needed by the import service. For example the structure for the member data as the import service likes it, for the oauth tokens, plugin details etc etc. Please check them out for more info, there are comments everywhere.  This is just for helping the development process. Instead of defining your own from the beginning, you can use these, it is ez. The names of the files are similar to the routes because I tried to 'relate' the data types to the routes that will need them.\n\n#### 'middleware' folder\nHere the express middleware should be located, you can also add your own, but the important one is the one for error handling. I reccoment you implement error logic there.\n\n#### 'routes' folder\nThis folder contains the routes for our application, here the routes that are needed by the import service are already defined and their handlers are located in the 'handlers' folder. Here you can use the apidoc comments to document your api methods. The import service will use this routes to communicate with your plugin. \n\n#### 'handlers' folder\nHere the handlers for the routes are located. I put them separately here so that the code comes out cleaner in the end. There is 1 file for each of the routes defined in routes.js. The methods are empty and await your implementation. Here you will be doing most of the things like communicationg with external apis, validating data, returning responses in the format the import service requires. \n\n#### 'init' folder\nHere only server.ts is located. It is basically an express server that uses https(These plugins work only with https). You don't have to change this file unless you want to disable CORS or add new stuff.\n\n#### 'tests' folder\nAll tests should be located here and follow the same structure as the 'src' folder. The command to run tests and generate code-coverage reports are located at beginning of this document. Mocha, sinon and chai are used for testing.\n\n#### 'util' folder\nThis is purely a utility folder, any helper functions or classes you can put in here. I also recommend putting here the utility methods for communications with external api and such. \n\n\n\n### HTTPS\n\nPlugins will not work without https.\n\n\n### API documentation\n\nYou can check out the api docs in \u003chost\u003e/api/docs.\n\n### Code coverage report\n\nCode coverage report in html is located in \u003croot\u003e/coverage/lcov-report/index.html and the report in JSON in \u003croot\u003e/coverage/coverage.json.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoosend%2Fimport-service-plugin-starter-pack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoosend%2Fimport-service-plugin-starter-pack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoosend%2Fimport-service-plugin-starter-pack/lists"}