1.1.9 • Published 6 years ago

spring-but-js v1.1.9

Weekly downloads
4
License
WTFPL
Repository
github
Last release
6 years ago

Spring but JS

NPM

Build Status

Use annotations and Spring Inversion of Control in NodeJS! Easily set up a REST endpoint like you would in a Spring Boot application.

Not actually affiliated with Spring.

Install

npm install spring-but-js --save

A demonstration

Below is a small project that makes use of SpringButJs, showcasing simple IoC and Web MVC mechanics to set up a web service.

main.js

const SpringButJs = require('spring-but-js');
SpringButJs.scanComponents('components', process.argv);

components/my-service.js

'@Service'
function MyService() {

    this.getHello = function() {
        return 'Hello from MyService!';
    }
}

components/my-controller.js

'@RestController'
'@RequestMapping("/hello")'
function MyController() {

    let myService;
    
    '@Autowired'
    this.setMyService = function(_myServive) {
        myService = _myService;
    }

    '@RequestMapping("/")'
    this.myOtherFunction = function(req, res) {
        res.send(myService.getHello());
    }
}
GET http://localhost/hello => 200: 'Hello from MyService!'

Documentation

View the GitHub Wiki for more documentation!

1.1.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.1.5

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago