Code Monkey home page Code Monkey logo

Comments (3)

MahdiSaber avatar MahdiSaber commented on July 22, 2024

This repository seems to be outdated. I had the same problem.
In order to fix the issue, try this command:
.\node_modules\.bin\ts-node -P .\server.tsconfig.json .\server.ts

The content of server.ts is as follows:

import * as express from 'express';
import {Application} from 'express';
import {getAllCourses} from './server/get-courses.route';
import {saveCourse} from './server/save-course.route';


const bodyParser = require('body-parser');

const app: Application = express();

app.use(bodyParser.json());

app.route('/api/courses').get(getAllCourses);

app.route('/api/courses/:id').put(saveCourse);



const httpServer = app.listen(9000, () => {
    console.log('HTTP REST API Server running at http://localhost:' + httpServer.address().port);
});

from angular-course.

sandeepsauravdas avatar sandeepsauravdas commented on July 22, 2024

image_2022-09-19_205009436
For me, the Express server runs however when checking on the link i.e. localhost:9000 all I get is the above error message
Cannot GET /

Below is the output from npm run server:

> [email protected] server C:\FisherSS\angular-course
> ts-node -P ./server.tsconfig.json ./server.ts

HTTP REST API Server running at http://localhost:9000

from angular-course.

rgbk21 avatar rgbk21 commented on July 22, 2024

When I google, this is the link that comes up. Doing this fixe the issue in my case. Replace the "server" in package.json with this:

"server": "node ./node_modules/ts-node/dist/bin.js -P ./server.tsconfig.json ./server.ts"

What we are doing is side-stepping usage of the bash file and directly pointing to the binary as mentioned here.

from angular-course.

Related Issues (15)

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.