Giter VIP home page Giter VIP logo

typescript-node's Introduction

typescript-node Build Status codecov Codacy Badge

Template for building nodejs and typescript services. The main goal of this boilerplate is to offer a good Developer Experience (eg: debugging, watch and recompile) by providing the following features out of the box:

Features

Installation & Run

  • npm install - Install dependencies
  • npm run start - Start application (It needs a mysql database)

Running with Docker

  • docker-compose up (compose and run, it also creates the mysql database)
  • docker-compose down (Destroy application and mysql containers)

Useful npm commands

  • npm run build - Transpile TypeScript code
  • npm run clean - Remove dist, node_modules, coverage folders
  • npm run coverage - Run NYC coverage
  • npm run lint - Lint your TypeScript code
  • npm run start:dev - Run application in dev mode (debug & watch). Debug mode is running on port 5858 (open chrome://inspect/#devices).
  • npm run test - Run unit tests
  • npm run test:integration - Run integration tests
  • npm run test:all - Run Unit and Integration tests

typescript-node's People

Contributors

dependabot[bot] avatar sledorze avatar talento90 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

typescript-node's Issues

Official InversifyJS example

Hi I'm the author of InnversifyJS we have an official repository for examples. As you can see here I was planning to add a node + express example but your example uses hapi but that would be good too ๐Ÿ˜„

Would you like to contribute this example to the official InversifyJS examples?

Inversify update

Hi as from inversify beta.9 there is no IKernel exported anymore you need to use it like this, can you update seed with thees breaking changes?

`import { Kernel, interfaces } from "inversify";

let kernel: interfaces.Kernel = new Kernel();

kernel.bind<interfaces.Factory>("Weapon").toFactory((context) => {
return () => {
return kernel.get("Weapon");
};
});`

Best, M

Setup & building is not working

Hi,
i cloned the project, executed "npm run setup":

> [email protected] setup /Users/arthur/Development/arthel/nodejs/cheerio/lazygold/backend/lazygold-price_typescript
> npm install & typings install
โ””โ”€โ”€ (No dependencies)

Then i executed "npm run build":

> [email protected] build /Users/arthur/Development/arthel/nodejs/cheerio/lazygold/backend/lazygold-price_typescript
> gulp build

[16:47:28] Using gulpfile ~/Development/arthel/nodejs/cheerio/lazygold/backend/lazygold-price_typescript/gulpfile.js
[16:47:28] Starting 'tslint'...
[16:47:28] Starting 'compile'...
TypeScript  Version 1.8.10

[16:47:29] Finished 'tslint' after 1.31 s
src/controllers/taskController.ts(1,23): error TS2307: Cannot find module 'hapi'.
src/controllers/taskController.ts(2,23): error TS2307: Cannot find module 'boom'.
src/controllers/taskController.ts(3,22): error TS2307: Cannot find module 'joi'.
src/libs/ioc/index.ts(4,13): error TS2304: Cannot find name 'process'.
src/libs/ioc/index.ts(8,1): error TS2304: Cannot find name 'require'.
src/libs/plugins/interfaces.ts(1,23): error TS2307: Cannot find module 'hapi'.
src/libs/repository/mongo/mongoRepository.ts(1,26): error TS2307: Cannot find module 'mongodb'.
src/models/taskModel.ts(1,22): error TS2307: Cannot find module 'joi'.
src/routes/index.ts(1,23): error TS2307: Cannot find module 'hapi'.
src/server.ts(2,23): error TS2307: Cannot find module 'hapi'.
src/server.ts(5,23): error TS2307: Cannot find module 'path'.
src/server.ts(6,21): error TS2307: Cannot find module 'fs'.
src/server.ts(11,14): error TS2304: Cannot find name 'process'.
src/server.ts(22,21): error TS2304: Cannot find name '__dirname'.
src/server.ts(26,28): error TS2304: Cannot find name 'require'.
typings.d.ts(1,1): error TS6053: File '/Users/arthur/Development/arthel/nodejs/cheerio/lazygold/backend/lazygold-price_typescript/typings/main.d.ts' not found.
src/configs/configurations.ts(10,21): error TS2304: Cannot find name 'process'.
src/configs/configurations.ts(11,24): error TS2304: Cannot find name 'require'.
src/index.ts(3,35): error TS2304: Cannot find name 'process'.
src/libs/ioc/inversify.dev.config.ts(1,10): error TS2305: Module '"inversify"' has no exported member 'IKernel'.
src/libs/ioc/inversify.test.config.ts(1,10): error TS2305: Module '"inversify"' has no exported member 'IKernel'.
src/libs/plugins/logger/index.ts(2,23): error TS2307: Cannot find module 'hapi'.
src/libs/plugins/logger/index.ts(10,31): error TS2304: Cannot find name 'require'.
src/libs/plugins/logger/index.ts(16,27): error TS2304: Cannot find name 'require'.
src/libs/plugins/swagger/index.ts(2,23): error TS2307: Cannot find module 'hapi'.
src/libs/plugins/swagger/index.ts(8,17): error TS2304: Cannot find name 'require'.
src/libs/plugins/swagger/index.ts(9,17): error TS2304: Cannot find name 'require'.
src/libs/plugins/swagger/index.ts(11,31): error TS2304: Cannot find name 'require'.
test/repository/memory/taskRepositoryTests.ts(2,23): error TS2307: Cannot find module 'chai'.
test/repository/memory/taskRepositoryTests.ts(9,1): error TS2304: Cannot find name 'describe'.
test/repository/memory/taskRepositoryTests.ts(10,3): error TS2304: Cannot find name 'it'.
test/repository/mongo/taskRepositoryTests.ts(2,23): error TS2307: Cannot find module 'chai'.
test/repository/mongo/taskRepositoryTests.ts(13,1): error TS2304: Cannot find name 'describe'.
test/repository/mongo/taskRepositoryTests.ts(14,3): error TS2304: Cannot find name 'it'.
test/server/taskControllerTests.ts(2,23): error TS2307: Cannot find module 'chai'.
test/server/taskControllerTests.ts(10,1): error TS2304: Cannot find name 'describe'.
test/server/taskControllerTests.ts(11,5): error TS2304: Cannot find name 'it'.
test/server/taskControllerTests.ts(18,5): error TS2304: Cannot find name 'it'.
test/server/taskControllerTests.ts(36,5): error TS2304: Cannot find name 'it'.
test/server/taskControllerTests.ts(43,5): error TS2304: Cannot find name 'it'.

[16:47:31] 'compile' errored after 2.82 s
[16:47:31] Error: Command failed: tsc

    at ChildProcess.exithandler (child_process.js:202:12)
    at emitTwo (events.js:100:13)
    at ChildProcess.emit (events.js:185:7)
    at maybeClose (internal/child_process.js:850:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)
    at emitOne (events.js:90:13)
    at Socket.emit (events.js:182:7)
    at Pipe._onclose (net.js:475:12)

npm ERR! Darwin 15.5.0
npm ERR! argv "/Users/arthur/.nvm/versions/node/v5.10.1/bin/node" "/Users/arthur/.nvm/versions/node/v5.10.1/bin/npm" "run" "build"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `gulp build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script 'gulp build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the typescript-node package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs typescript-node
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls typescript-node
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/arthur/Development/arthel/nodejs/cheerio/lazygold/backend/lazygold-price_typescript/npm-debug.log

Some improvements

Nice project! I love some decissions about the structure and other things, just some doubts about typescript, just for curiosity.

In your feature index.ts files, you send in the init method the Hapi Server, this server are not sended in the plugin's load?

By the way, I strong recomending you see this branch https://github.com/thebergamo/start-hapiness/tree/dev-2.0

Btw, again nice project :D

Explain the project structure?

Can you explain what the mean of each folders or files of these project structure, such as :

  • src
    • entities
    • lib
    • managers
    • repositories
    • server
      • health
      • middlewares
      • tasks
      • users
    • container file
    • errors file

add prefix

how to add router prefix

I added it in configuration/config.de.json and it does not work

example:
{
"database": {
"connectionString": "mongodb://localhost/taskdb-dev"
},
"server": {
"routes": {
"prefix": "/api"
},

"port": 5000,
"jwtSecret": "random-secret-password",
"jwtExpiration": "1h",
"plugins": [
"logger",
"swagger",
"jwt-auth"
]
}
}

3rd party lib interaction and routing

Hey @Talento90,

i think this seed will need an option to interact with 3rd party library so there will need to be some service folder that make this possible. In services can be logic to integrate Facebook, Slack, S3...

Next what i think this seed need separated routing for each controller(todos, users)

Example for routes:
- controllers
--users
--todos
- routes
--users
--todos

What do you think about this?

Best M

how to create migration?

I use global knex cli create migrate file in migrations. But when i modify the file then the migration will be migrated. How do you create migrate file and modify it?

JWT Tokens

Hey,

In README.md it is written "JWT Tokens" but "JWT" stands for "JSON Web Token" meaning README.md deals with "JSON Web Token Tokens".

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.