Skip to content

joelbinn/nodejs-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Seed project for a Express server implemented in Typescript

This is an example project for an Express server implemented in typescript.

NPM command scripts

  • start: builds the server and then starts it.
  • start:watch: starts the server and continuously rebuilds it if any typescript file changes; to be used in development.
  • test: executes the tests.
  • test:watch: starts the test execution and continuously restarts tests if any typescript file changes; to be used in development.
  • clean: clean out all *.js and *.map.js (resulting from Typescript compilation) files from ./src and ./test.

About the application structure

The application is built on a structure of routers and sub-routers corresponding to the resource structure of the REST API, which has its root in api/. Each sub-router is placed in its own module directory:

  • src/api: provides the express root application resource for api/...
  • src/api/v1-resource: provides the implementation of the sub-router for /api/v1/...
  • src/api/v1-resource/jobs-resource: provides the implementation of the sub-router for api/v1/jobs/.... This resource provides an example of posting jobs into a queue (based on Kue) which executes the jobs in the background.
  • src/api/v1-resource/users-resource: provides the implementation of the sub-router for api/v1/users/.... The resource mimics a DB server which just returns a list of user names.

Each of the module directories has a corresponding BDD style test specification in ./test. These tests use mocha as test runner and chai for assertions.

Dependencies

The Kue component is based on Redis. In order to run the server a Redis instance must be created. A suggestion is to use the official Redis docker image.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published