stellar-deprecated / stex

DEPRECATED. An opinionated framework built on top of expressjs used to build better web services for stellar
Other
30 stars 11 forks source link

Add "scripts" support #10

Closed nullstyle closed 10 years ago

nullstyle commented 10 years ago

STORY

As a developer building an application on top of stex, I would like to be able to easily defined multiple entrypoints for my application, so that I can build one-time processes, cron-based repeated jobs, or multiple web service APIs on top of one codebase

RATIONALE

Presently, there are only 2 types of processes that can be started on top of stex... the www process started via stex run www and the repl process started via stex console. The goal of this issue is to unify how we launch processes within stex as well as enable an application to define their own entrypoints.

For example, you may have a custom job queue running process that you want run within the stex ecosystem (giving access to the db,log,conf globals). Or you may have written a database cleaning process to resolve some prior corruption.

DESIGN IDEAS

The following paragraph describes a possible design:

Every stex application has a top-level folder called scripts. By default, it is populated with 2 files: www.js, and console.js. These two scripts can be launched with either stex run www or stex run console respectively.

A script launched in this manner (via stex run NAME) will execute after having the stex ecosystem loaded and initialized.

A developer can define additional scripts simply by creating new files within the scripts folder, which can then be run as expected by executing stex run. In this way, stex run NAME is just an alias for: node scripts/NAME.js.

lookis commented 10 years ago

I create a pull request to solve this issue https://github.com/stellar/stex/pull/13

nullstyle commented 10 years ago

Fixed in #13