Check out the blog post.
- Fork/Clone
- Install dependencies -
npm install
- Compile -
npm run build
- Compile assets -
gulp assets
- Run the development server -
npm start
- Test -
npm test
Home Page: http://mherman.org/blog/2016/11/05/developing-a-restful-api-with-node-and-typescript
Check out the blog post.
npm install
npm run build
gulp assets
npm start
npm test
I can't run npm start, because i get an error that data.json can't be found in compiled js file. I tried many patch, but none of them work.
Is it intentional?
Thank you for your great Typescript example! I just found a small typo in the 'Want to use this project?' section of the README.md file:
Wrong: gulp script
Correct: gulp scriptS
A small but important typo ;)
Cannot find module '../data' (const Heroes = require('../data');)
when using npm start i am getting this error plz help
Individual tests run fine and pass, but npm test reports:
Warning: Could not find any test files matching pattern: 'test/**/*.test.ts' No test files found npm ERR! Test failed. See above for more details.
Seems to be a common issue with Typescript, mocha and windows. Haven't seen a good solution.
$ npm test
> [email protected] test /Users/username/GitHub/typescript-node-api
> mocha --reporter spec --compilers ts:ts-node/register 'test/**/*.test.ts'
/Users/username/GitHub/typescript-node-api/node_modules/ts-node/src/index.ts:312
throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
^
TSError: ? Unable to compile TypeScript
Cannot find type definition file for 'body-parser'. (2688)
Cannot find type definition file for 'chai'. (2688)
Cannot find type definition file for 'chai-http'. (2688)
Cannot find type definition file for 'debug'. (2688)
Cannot find type definition file for 'express'. (2688)
Cannot find type definition file for 'express-serve-static-core'. (2688)
Cannot find type definition file for 'mime'. (2688)
Cannot find type definition file for 'mocha'. (2688)
Cannot find type definition file for 'morgan'. (2688)
Cannot find type definition file for 'node'. (2688)
Cannot find type definition file for 'serve-static'. (2688)
test/helloWorld.test.ts (1,24): Cannot find module 'mocha'. (2307)
test/helloWorld.test.ts (2,23): Cannot find module 'chai'. (2307)
test/helloWorld.test.ts (3,27): Cannot find module 'chai-http'. (2307)
test/helloWorld.test.ts (5,17): Cannot find module '../src/App'. (2307)
test/helloWorld.test.ts (10,1): Cannot find name 'describe'. (2304)
test/helloWorld.test.ts (12,3): Cannot find name 'it'. (2304)
test/helloWorld.test.ts (19,3): Cannot find name 'it'. (2304)
hey, I am trying to push (via PR) some improvements to the test cases? Would you be so kind to allow be branching and raising a PR? thx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.