This is a simple hapijs (nodejs) starter template that should be used as an api. It is inspired by dwyl/hapi-typescript-example.
- TODO
- TODO
npm install
(Install node packages)typings install
(Install typings)
# Start Testing with livereload on file change
env=testing db=testing port=8201 npm test # port change is needed to throw out all the loggings
# Run Production Server (default port 8100) with livereload on file change
port=8200 npm start # changes default port to 8200
# Typescript Lint
npm run tslint
Uses the (chai-assert testing library)[http://chaijs.com/api/assert/].
Is inspired by the method outmoded/discuss#214 describes.
When you start npm test
with the environment variable db=testing
the test server will create a mongodb with location testingdb.
The Documentation is Running on port 8100 by default settings. Go to http://localhost:8100/documentation to see the documentation generated by swagger.
npm run merge.preview
- This will fetchupstream
and show you how the merge would looknpm run merge
- This will actually do the merge- Handle any conflicts to get latest upstream into your application.
- Continue building your app.
You can read more about syncing a fork here.
If you have any suggestions to this workflow, please post here.
There are at least two ways to integrate the api in your project. As a submodule to an existing project or as standalone project.
- create a repository for your api-server (for example server-api)
- add that repository as a submodule to your project
cd YOUR_PROJECT
git submodule add https://github.com/YOUR_GITHUB_NAME/server-api.git
- download the hapi-seed-advanced zip (do not clone it)
- extract the zip-content into your submodule (server-api)
- add upstream
git remote add upstream https://github.com/divramod/hapi-seed-advanced.git
- install dependencies
npm install
typings install
- create a repository for your api-server
- download the hapi-seed-advanced zip (do not clone it)
- extract the zip-content into your submodule (server-api)
- add upstream
git remote add upstream https://github.com/divramod/hapi-seed-advanced.git
- src/routes/index.ts --> add routes (shortcut: TODO)
- src/models/ENTIYNAME.ts --> add model (shortcut: TODO)
- src/controllers/ENTITIYNAME.ts --> add controller (shortcut: TODO)
- src/libs/repository/interfaces.ts --> add entity interface (shortcut: TODO)
- src/libs/repository/mongo/ENTITYNAMERepostory.ts --> add repository (shortcut: TODO)
- test/YOUR_FEATURE_NAMETests.ts
- run
npm test
Please see the CONTRIBUTING file for guidelines.
- create a npm module to help with the How To's
- docs: add a section where i describe how to use it in your own project
- [ ]