Skip to content

jcmdsbr/node-ts-basic-concepts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

The Node basic concepts in ts using mongodb 😎

  • Learning node using typescript, express and mongo

Give a Star! ⭐

If you liked the project, please give a star ;)

You need some of the fallowing tools ❗

  • Visual Studio Code
  • Node 8+

Description πŸ“š

As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications. In the following "hello world" example, many connections can be handled concurrently. Upon each connection, the callback is fired, but if there is no work to be done, Node.js will sleep.

class Startup {
    
    app: express.Application;

    constructor() {
        this.app = express();
        this.configureServices();
        this.configure();
    }

    configureServices() {
        MongoContext.createConnection();
        this.app.use(bodyParser.json());
        this.app.use(bodyParser.urlencoded({ extended: false }));
    }

    configure() {
        this.app.route('/').get((req, res) => {
            return res.send({ version: '0.0.1' });
        });

        // news
        this.app.route('/api/v1/news').get(NewsController.getAsync);
        this.app.route('/api/v1/news/:id').get(NewsController.getByIdAsync);
        this.app.route('/api/v1/news').post(NewsController.addAsync);
        this.app.route('/api/v1/news/:id').put(NewsController.updateAsync);
        this.app.route('/api/v1/news/:id').delete(NewsController.deleteAsync);
    }
}

Official Links 🚧

About

Learning node using typescript, express and mongo

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published