Code Monkey home page Code Monkey logo

hapi-seed-advanced's Introduction

Description: node-hapi-typescript-seed

This is a simple hapijs (nodejs) starter template that should be used as an api. It is inspired by dwyl/hapi-typescript-example.

Table of Contents

Features

  • TODO

Prerequsits

  • TODO

Installation

  • npm install (Install node packages)
  • typings install (Install typings)

Run

# 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

Testing

TODO's

  • is it possible/sensible to test an interface?

Links

Uses the (chai-assert testing library)[http://chaijs.com/api/assert/].

Route Testing

Is inspired by the method outmoded/discuss#214 describes.

Database/Repository Testing

When you start npm test with the environment variable db=testing the test server will create a mongodb with location testingdb.

Documentation

The Documentation is Running on port 8100 by default settings. Go to http://localhost:8100/documentation to see the documentation generated by swagger.

How To's

Merging latest upstream changes

  1. npm run merge.preview - This will fetch upstream and show you how the merge would look
  2. npm run merge - This will actually do the merge
  3. Handle any conflicts to get latest upstream into your application.
  4. Continue building your app.

You can read more about syncing a fork here.

If you have any suggestions to this workflow, please post here.

How to use in your project

There are at least two ways to integrate the api in your project. As a submodule to an existing project or as standalone project.

Add as a submodule to an existing project

  1. create a repository for your api-server (for example server-api)
  2. add that repository as a submodule to your project
cd YOUR_PROJECT
git submodule add https://github.com/YOUR_GITHUB_NAME/server-api.git
  1. download the hapi-seed-advanced zip (do not clone it)
  2. extract the zip-content into your submodule (server-api)
  3. add upstream
git remote add upstream https://github.com/divramod/hapi-seed-advanced.git
  1. install dependencies
npm install
typings install

Create as standalone project

  1. create a repository for your api-server
  2. download the hapi-seed-advanced zip (do not clone it)
  3. extract the zip-content into your submodule (server-api)
  4. add upstream
git remote add upstream https://github.com/divramod/hapi-seed-advanced.git

add a new entity

  • 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)

add a new test

  • test/YOUR_FEATURE_NAMETests.ts
  • run npm test

Contributing

Please see the CONTRIBUTING file for guidelines.

ToDo's

  • 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
  • [ ]

hapi-seed-advanced's People

Stargazers

Matija Žolek avatar

Watchers

Arvid Petermann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.