{"id":19020230,"url":"https://github.com/trailsjs/trailpack-express","last_synced_at":"2025-04-23T05:24:40.633Z","repository":{"id":55923922,"uuid":"46914743","full_name":"trailsjs/trailpack-express","owner":"trailsjs","description":":package: Express Trailpack","archived":false,"fork":false,"pushed_at":"2020-12-07T02:15:53.000Z","size":340,"stargazers_count":12,"open_issues_count":8,"forks_count":14,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-15T20:01:59.341Z","etag":null,"topics":["express","trailpack","trails"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trailsjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-26T08:48:35.000Z","updated_at":"2024-03-07T07:24:04.000Z","dependencies_parsed_at":"2022-08-15T09:31:16.372Z","dependency_job_id":null,"html_url":"https://github.com/trailsjs/trailpack-express","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-express","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-express/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-express/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-express/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trailsjs","download_url":"https://codeload.github.com/trailsjs/trailpack-express/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250375127,"owners_count":21420059,"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":["express","trailpack","trails"],"created_at":"2024-11-08T20:16:11.972Z","updated_at":"2025-04-23T05:24:40.597Z","avatar_url":"https://github.com/trailsjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trailpack-express\n:package: Express Trailpack\n\n[![Gitter][gitter-image]][gitter-url]\n[![NPM version][npm-image]][npm-url]\n[![Linux + OSX Build Status][ci-image]][ci-url]\n[![Code Climate][codeclimate-image]][codeclimate-url]\n[![Follow @trailsjs on Twitter][twitter-image]][twitter-url]\n\nThis pack binds the routes compiled in [trailpack-router](https://github.com/trailsjs/trailpack-router)\nto an [Express Server](http://expressjs.com/en/api.html). \n\n## Install\n\n```\n$ npm install --save trailpack-express\n```\n\n## Compatibility\n\nThis Trailpack is compatible with Express [v4](http://expressjs.com/en/4x/api.html) and [v5](https://github.com/expressjs/express/tree/5.0).\n\n#### Express v4\n\n```\n$ npm install --save express@^4\n```\n\n#### Express v5\n\n```\n$ npm install --save express@^5.0.0-alpha.2\n```\n\n## Usage\nLoad in your trailpack config.\n\n```js\n// config/main.js\nmodule.exports = {\n  // ...\n  packs: [\n    require('trailpack-core'),\n    require('trailpack-router'),\n    require('trailpack-express')\n  ]\n}\n```\n\n## Static assets\n```js\n// config/main.js\nmodule.exports = {\n  // ...\n  paths: {\n    ...\n    www: path.resolve(__dirname, '..', 'public')\n    ...\n  }\n}\n```\n\n## View Config\nChoose a template engine.\n\n```js\n// config/views.js\nmodule.exports = {\n  engine: 'pug'\n}\n```\n\nThen simply write your views in a directory called 'views'!\n\n## Configuration\n\nSee [`config/web.js`](https://github.com/trailsjs/trailpack-express/blob/master/archetype/config/web.js) for a full example.\n\n#### `express`\nRequire field to set express version to use by setting `express: require('express')`\n\n#### `cors`\nOptional field to configure CORS, can be a boolean or an object (see https://github.com/expressjs/cors#configuring-cors)\n\n#### `port`\nThe port to listen on. `3000` by default. Can also be set via the `PORT` environment variable.\n\n#### `host`\nThe hostname of the server.\n\n#### `cache`\nThe number of seconds to cache flat files on disk being served by Express\n\n#### `externalConfig`\nexternal configuration for your express app (can be used for configuring letsencrypt)\n\n#### `ssl`\nSSL options (`key`, `cert` or `pfx`) to allow set https protocol\n\n#### `redirectToHttps`\nAutomatically redirect HTTP request to HTTPS if ssl enabled\n\n#### `portHttp`\nThe port to listen for http protocol if ssl enabled. If you don't want http and https, don't add this field.\n\n#### `middlewares`\nObject to add custom middleware functions to Express, don't forget to add them into `middlewares.order` or they will not be called\n\n### `init`\nMethod to customize express instance\n\n## Contributing\nWe love contributions! Please check out our [Contributor's Guide](https://github.com/trailsjs/trails/blob/master/.github/CONTRIBUTING.md) for more\ninformation on how our projects are organized and how to get started.\n\n## License\n[MIT](https://github.com/trailsjs/trailpack-express/blob/master/LICENSE)\n\n[trails-image]: http://i.imgur.com/zfT2NEv.png\n[trails-url]: http://trailsjs.io\n[npm-image]: https://img.shields.io/npm/v/trailpack-express.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/trailpack-express\n[ci-image]: https://img.shields.io/travis/trailsjs/trailpack-express.svg?style=flat-square\u0026label=Linux%20/%20OSX\n[ci-url]: https://travis-ci.org/trailsjs/trailpack-express\n[codeclimate-image]: https://img.shields.io/codeclimate/github/trailsjs/trailpack-express.svg?style=flat-square\n[codeclimate-url]: https://codeclimate.com/github/trailsjs/trailpack-express\n[gitter-image]: http://img.shields.io/badge/+%20GITTER-JOIN%20CHAT%20%E2%86%92-1DCE73.svg?style=flat-square\n[gitter-url]: https://gitter.im/trailsjs/trails\n[twitter-image]: https://img.shields.io/twitter/follow/trailsjs.svg?style=social\n[twitter-url]: https://twitter.com/trailsjs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailsjs%2Ftrailpack-express","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrailsjs%2Ftrailpack-express","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailsjs%2Ftrailpack-express/lists"}