{"id":16372447,"url":"https://github.com/mgwidmann/express-rails","last_synced_at":"2025-06-26T02:33:35.288Z","repository":{"id":12572352,"uuid":"15242905","full_name":"mgwidmann/express-rails","owner":"mgwidmann","description":"A template express application which is organized like a typical Rails application","archived":false,"fork":false,"pushed_at":"2013-12-17T04:15:20.000Z","size":140,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-24T22:35:45.903Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgwidmann.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":"2013-12-17T02:18:44.000Z","updated_at":"2013-12-17T04:15:20.000Z","dependencies_parsed_at":"2022-09-11T16:40:41.041Z","dependency_job_id":null,"html_url":"https://github.com/mgwidmann/express-rails","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mgwidmann/express-rails","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgwidmann%2Fexpress-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgwidmann%2Fexpress-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgwidmann%2Fexpress-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgwidmann%2Fexpress-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgwidmann","download_url":"https://codeload.github.com/mgwidmann/express-rails/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgwidmann%2Fexpress-rails/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261986751,"owners_count":23240703,"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-11T03:11:25.360Z","updated_at":"2025-06-26T02:33:35.258Z","avatar_url":"https://github.com/mgwidmann.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"express-rails\n=============\n\nA template express application which is organized like a typical Rails application with minimal production dependencies.\n\nThe purpose of this project is to just provide a simple express template which has a included reloadable server, a configured testing framework which auto-watches all files, JSHint integration, environment based application configuration and the auto-require capability built into Rails.\n\nSee also:\n\n* [skeleton](https://github.com/EtienneLem/skeleton)\n* [express-coffee](https://github.com/twilson63/express-coffee)\n* [frappe](https://github.com/dweldon/frappe)\n\n# Installation\n\n    git clone git@github.com:mgwidmann/express-rails.git \u003cYOUR_PROJECT_NAME\u003e\n    cd \u003cYOUR_PROJECT_NAME\u003e \u0026\u0026 rm -rf ./.git \u0026\u0026 npm install\n\nCreate your git repo out of the \u003cYOUR_PROJECT_NAME\u003e folder.\n\n## Running\n\nTo run the server simply run the default grunt task:\n\n    grunt\n\nTo run the test watcher simply run:\n\n    grunt test\n\n# The `app` variable\n\nIn this project the app variable is passed into every file when it gets required. Since all files are required automatically by `config/boot.js`, the `app` variable acts as a global without actually being global. Each file should export a function which takes an `app` variable. If the file does not export a function, it will not hurt anything, you'll just lose access to the `app` variable.\n\n## Environment variables\n\nAn example of running the application without using `grunt` is:\n\n    LEVEL=info PORT=3000 NODE_ENV=development node app.js\n\n* LEVEL - Sets the logging level. Available levels are (lowest to highest) verbose, debug, info, warning, error, fatal. This can be changed by editing `config/initializers/logger.js`.\n* PORT - The port the node application should run on.\n* NODE_ENV - The node environment.\n\n## Importance of the `app` variable\n\n### Logging\n\nLogging is provided by (https://github.com/flatiron/winston) and is automatically loaded into `app.logger`. If you want to log anything, anywhere in your application, you'll need the `app` variable. Use it like so:\n\n    app.logger.info(\"This message provides information\");\n    app.logger.debug(\"This message provides debug data\");\n    app.logger.error(\"THIS MESSAGE IS AN ERROR!\");\n\n`app.logger` can be configured in config/initializers/logger.js if different winston settings are desired.\n\nThe log level can be changed by setting the `LEVEL` environment variable.\n\n### Environment Configuration\n\nConfiguration is automatically required based on the currently set `NODE_ENV`. The exports in config/environments/\u003cNODE_ENV\u003e.js will be placed into the `app` variable at `app.config`. The file `config/environments/defaults.js` is intended to hold your default configuration. In each environemnt file, simply require that file and overwrite the values you want to change. This makes a cleaner configuration setup that doesn't require performing deep merges or clones of configuration that is the same for multiple environments.\n\n\n# Initializers\n\nAll files in config/initializers will get required automatically. Also, they will get loaded at the very end of the boot process after all other objects are loaded. Use this to configure `npm` modules after the app is booted.\n\n# Controllers\n\nControllers are located in the app/controllers directory and the file name is called \u003cname\u003e_controller.js or \u003cname\u003eController.js. The app (express) variable is passed in if you export a function. An example CRUD controller would be:\n````\nmodule.exports = function(app){\n  return {\n     index: function(req, res){\n       // Return all objects\n     },\n     show: function(req, res){\n       // Return an object\n     },\n     edit: function(req, res){\n       // Return the edit page for an object\n     },\n     new: function(req, res){\n       // Return the new form for a new object\n     },\n     update: function(req, res){\n       // Update a object\n     },\n     create: function(req, res){\n       // Create an object\n     },\n     delete: function(req, res){\n       // Delete an object\n     }\n  }\n}\n````\n\n# Models\n\nModels are stored at app/models. At the moment, nothing like ActiveRecord is built-in. You can put your models here and it will be required automatically as well as get passed the `app` variable.\n\n# Views\n\nTODO\n\n# Middleware\n\nMiddleware functions are stored at app/middleware. If you export a function, you will get passed the app variable as well as have it required automatically. These functions are defined, but not inserted yet into the middleware stack. See config/middleware.js.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgwidmann%2Fexpress-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgwidmann%2Fexpress-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgwidmann%2Fexpress-rails/lists"}