
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@flowup/ng2-api
Advanced tools
Ng2-api is a package that allows to consume Http JSON APIs while retaining type-safety.
Ng2-api is a package that allows to consume Http JSON APIs while retaining type-safety.
You can install ng2-api via
$ yarn add @flowup/ng2-api
$ npm install @flowup/ng2-api --save
:robot: Please follow the Basic usage for the full example.
Ng2API supports GET, POST, PUT and DELETE calls in it's base. All methods can be called on
a single model or array, e.g.: get(modelArray)
or getSingle(model)
.
1) Initialize the module:
import { NgModule } from '@angular/core';
import { Ng2APIModule } from '@flowup/ng2-api';
@NgModule({
imports: [
Ng2APIModule.forRoot('base_serve_url.com', [
'BookResource', 'UserResource' // resources to be initialized
])
]
})
class AppModule {}
2) Define a model and a service afterwards
import { APIConfig, Resource } from '@flowup/ng2-api';
// api endpoint model
export interface User {
email: string
}
@Injectable()
export class UserService extends Resource<User> {
// inject and pass config, http and relative path to the Resource
constructor(config: APIConfig, http: Http) {
// initialize Resource
super(config, http, '/users');
}
}
3) Use the service within a component
@Component({...})
class MyComponent {
constructor(private users: UserService) { }
getUserById(id: number): Observable<User> {
// args will be added into the url: /users/:id
return users.getSingle({args: [id]});
}
createUser(user: User): Observable<User> {
// just pass the user object
return users.create(user);
}
}
For more examples visit the Cookbook
Run yarn build
to build the project. The build artifacts will be stored in the dist/
directory.
Run yarn test
to execute unit and e2e tests.
If you would like to contribute, read first through Angular contribution guidelines. Get the repository
$ git clone https://github.com/flowup/ng2-api.git
FAQs
Ng2-api is a package that allows to consume Http JSON APIs while retaining type-safety.
The npm package @flowup/ng2-api receives a total of 0 weekly downloads. As such, @flowup/ng2-api popularity was classified as not popular.
We found that @flowup/ng2-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.