|
| 1 | +# Express Typescript Boilerplate |
| 2 | + |
| 3 | +> Boilerplate for an restful express-apllication written in TypeScript |
| 4 | +
|
| 5 | +## Getting Started |
| 6 | +### Prerequisites |
| 7 | +* Install [Node.js](http://nodejs.org) |
| 8 | + * on OSX use [homebrew](http://brew.sh) `brew install node` |
| 9 | + * on Windows use [chocolatey](https://chocolatey.org/) `choco install nodejs` |
| 10 | +* Install yarn globally `npm install yarn -g` |
| 11 | + |
| 12 | +## Installing |
| 13 | +* `fork` this repo |
| 14 | +* `clone` your fork |
| 15 | +* `install:dev` to install all dependencies and typings |
| 16 | +* Create new database. You will find the name in the `src/config.ts` file. |
| 17 | +* `npm run db:migrate` to create the schema |
| 18 | +* `npm run db:seed` to insert some test data |
| 19 | +* `npm run serve` to start the dev server in another tab |
| 20 | + |
| 21 | +## Running the app |
| 22 | +After you have installed all dependencies you can now run the app. |
| 23 | +Run `npm run serve` to start a local server using `nodemon` which will watch for changes and then will restart the sever. |
| 24 | +The port will be displayed to you as `http://0.0.0.0:3000` (or if you prefer IPv6, if you're using `express` server, then it's `http://[::1]:3000/`). |
| 25 | + |
| 26 | +## Scripts / Commands |
| 27 | +### Install |
| 28 | +* Install all dependencies with `yarn install` |
| 29 | +* Install all typings with `npm run install:typings` |
| 30 | +* To install all dependencies and typings use `npm run install:dev` |
| 31 | +* Remove not needed libraries with `npm run install:clean` |
| 32 | + |
| 33 | +### Linting |
| 34 | +* Run code analysis using `npm run lint`. This runs tshint. |
| 35 | +* There is also a vscode task for this called lint. |
| 36 | + |
| 37 | +### Tests |
| 38 | +* Run the unit tests using `npm test`. |
| 39 | +* There is also a vscode task for this called test. |
| 40 | + |
| 41 | +### Running in dev mode |
| 42 | +* Run `npm run serve` to start nodemon with ts-node, which will serve your app. |
| 43 | +* The server address will be displayed to you as `http://0.0.0.0:3000` |
| 44 | + |
| 45 | +### Cleaning the project |
| 46 | +* Run `npm run clean` to remove all generated JavaScript files. |
| 47 | +* Run `npm run db:clean` to drop all tables of the database. |
| 48 | + |
| 49 | +### Building the project and run it |
| 50 | +* Run `npm run build` to generated all JavaScript files from your TypeScript sources. After this step you can deploy the app on any server. |
| 51 | +* There is also a vscode task for this called build. |
| 52 | +* To start the builded app use `npm start`. |
| 53 | +* With `npm run zip` it will generate the JavaScript source and pack them into to a deployable zip file into the dist folder. |
| 54 | + |
| 55 | +### Docs |
| 56 | +* Run `npm run docs` to generate all doc files and serve it on `http://0.0.0.0:8080` |
| 57 | + |
| 58 | +### Seed |
| 59 | +* Run `npm run db:seed` to seed some data into the database |
| 60 | + |
| 61 | +### Migration |
| 62 | +* Run `npm run db:migrate` to migration the new schema to the database |
| 63 | +* Run `npm run db:migrate:rollback` to rollback one version |
| 64 | + |
| 65 | + |
| 66 | +## Related Projects |
| 67 | +* [express-graphql-typescript-boilerplate](https://github.com/w3tecch/express-graphql-typescript-boilerplate) - A starter kit for building amazing GraphQL API's with TypeScript and express by @w3tecch |
| 68 | +* [aurelia-typescript-boilerplate](https://github.com/w3tecch/aurelia-typescript-boilerplate) - An Aurelia starter kit with TypeScript |
| 69 | + |
| 70 | +## License |
| 71 | +MIT |
| 72 | + |
| 73 | +## Documentations |
| 74 | +* [Auth0 API Documentation](https://auth0.com/docs/api/management/v2#!/Users/get_users) |
| 75 | +* [Bookshelf Cheatsheet](http://ricostacruz.com/cheatsheets/bookshelf.html) |
| 76 | + |
| 77 | +--- |
| 78 | +Made with ♥ by Gery Hirschfeld ([@GeryHirschfeld1](https://twitter.com/GeryHirschfeld1)) |
0 commit comments