This is an example node application built using TypeScript 1.5.0-beta and Hapi 8.8.0.
- Have Node v0.10.36 or higher installed
- Have MongoDB installed and a local server running
- Have TypeScript 1.5.0-beta or higher installed globally (
npm i -g tsd typescript@^1.5.3-beta
) - Code quality is maintained with the help of TSLint
- Run
git clone https://github.com/BrandonCKrueger/ts-hapi-mongo.git
to clone the repository - Run
npm install
to install dependencies - Run
tsd install
to install TypeScript typings dependencies (node, hapi, joi, bluebird, mongodb) - Compile the TypeScript
- From Terminal: `gulp'
- From VSCode:
CMD + SHIFT + B
for Mac |CTRL + SHIFT + B
for Windows
- Run
gulp develop
from the terminal, or debug from VSCode to start the server on port 3000
Base Routes
GET /
: Returns simple text that you've reached the base route using aGET
POST /
: Returns simple text that you've reached the base route using aPOST
Data Routes
Get /users
: Returns a list ofUsers(username: string, age: number)
from the databasePost /user
: Accepts a JSON object with ausername: string
parameter andage: number.integer
, adds that object to theUsers
list and returns the new list