Skip to content

Commit 7fe8681

Browse files
committed
added inject
1 parent 7b6223f commit 7fe8681

File tree

8 files changed

+99
-9
lines changed

8 files changed

+99
-9
lines changed

src/content/002-getting-started-with-a-boilerplate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: post
33
title: 'Getting started with the Boilerplate 🏁'
44
author: [gallayl]
5-
tags: ['getting-started', 'boilerplate']
5+
tags: ['Getting Started', 'boilerplate']
66
image: img/002-getting-started-with-a-boilerplate-cover.jpg
77
date: '2021-06-23T08:48:20.257Z'
88
draft: false

src/content/003-getting-started-with-inject.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
layout: post
33
title: 'DI / IOC with @furystack/inject 💉'
44
author: [gallayl]
5-
tags: ['getting-started', 'inject']
5+
tags: ['Getting Started', 'inject']
66
image: img/003-getting-started-with-inject-cover.jpg
77
date: '2021-06-23T08:58:20.257Z'
88
draft: false
99
excerpt: Dependency injection and Inversion of control is a common practice that tries to protect you from insanity that would happen when you realize that you can't refactor and test a giant global static app structure. @furystack/inject is a simple but powerful tool that you can use in NodeJs and in the browser.
1010
---
1111

12+
1213
## Injectable services
1314
An _injectable service_ is basically a class, decorated with the `@Injectable()` decorator. If you decorate a class, its injectable options (e.g. lifetime) and constructor argument types will be stored and the injector will be able to instantiate a new instance any time. Constructor arguments should be also _injectable services_ and they will be resolved recursively. Take a look at the following example and you'll get the idea:
1415

@@ -54,4 +55,8 @@ The package defines four types of lifecycle:
5455
- **Explicit** values are not really injectables - you can call `injector.setExplicitInstance(myServiceInstance)` to set up an instance manually. Just like scoped services, explicit instances will be returned from the current scope only.
5556

5657
## Extension methods
57-
A simple injector can be easily extended by 3rd party packages with extension methods, just like the FuryStack packages. These extension methods usually provides a _shortcut_ of an instance or sets up a preconfigured explicit instance of a service. You can build clean and nice fluent API-s in that way - you can get the idea from one of the [FuryStack Injector Extensions](https://github.com/furystack/furystack/blob/develop/packages/rest-service/src/injector-extensions.ts)
58+
A simple injector can be easily extended by 3rd party packages with extension methods, just like the FuryStack packages. These extension methods usually provides a _shortcut_ of an instance or sets up a preconfigured explicit instance of a service. You can build clean and nice fluent API-s in that way - you can get the idea from one of the [FuryStack Injector Extensions](https://github.com/furystack/furystack/blob/develop/packages/rest-service/src/injector-extensions.ts)
59+
60+
You find more inject-related articles [here](/tags/inject) or check out the package at NPM
61+
62+
[![npm](https://img.shields.io/npm/v/@furystack/inject.svg?maxAge=3600)](https://www.npmjs.com/package/@furystack/inject)
62 KB
Loading
143 KB
Loading

src/content/img/tag-inject.jpg

511 KB
Loading

src/content/tag.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
- id: announcement
2-
description: Generic announcements
3-
image: img/furystack-logo-512.png
1+
- id: Getting Started
2+
description: Guides about basic concepts
3+
image: img/tag-getting-started.jpg
4+
- id: boilerplate
5+
description: The Boilerplate project is your best friend if you want to get familiar with FuryStack or start a new FuryStack project
6+
image: img/tag-boilerplate.jpg
7+
- id: inject
8+
description: \@furystack/inject or other DI/IOC - related posts
9+
image: img/tag-inject.jpg

src/pages/packages.tsx

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import React from "react"
2+
import { Helmet } from "react-helmet"
3+
import { Footer } from "../components/Footer"
4+
import SiteNav from "../components/header/SiteNav"
5+
import { PostFullContent } from "../components/PostContent"
6+
import { Wrapper } from "../components/Wrapper"
7+
import IndexLayout from "../layouts"
8+
import { SiteHeader, SiteArchiveHeader, outer, SiteNavMain, inner, SiteMain, NoImage } from "../styles/shared"
9+
import { PostFull, PostFullHeader, PostFullTitle } from "../templates/post"
10+
import { css } from '@emotion/react';
11+
import { colors } from '../styles/colors';
12+
13+
14+
15+
const PageTemplate = css`
16+
.site-main {
17+
margin-top: 64px;
18+
padding-bottom: 4vw;
19+
background: #fff;
20+
}
21+
22+
@media (prefers-color-scheme: dark) {
23+
.site-main {
24+
/* background: var(--darkmode); */
25+
background: ${colors.darkmode};
26+
}
27+
}
28+
`;
29+
30+
31+
const PackagesPage: React.FC = () => {
32+
return <IndexLayout>
33+
<Helmet>
34+
<title>Packages</title>
35+
</Helmet>
36+
<Wrapper css={PageTemplate}>
37+
<header className="site-archive-header no-image" css={[SiteHeader, SiteArchiveHeader]}>
38+
<div css={[outer, SiteNavMain]}>
39+
<div css={inner}>
40+
<SiteNav isHome={false} />
41+
</div>
42+
</div>
43+
</header>
44+
<main id="site-main" className="site-main" css={[SiteMain, outer]}>
45+
<div css={inner}>
46+
<article className="post page" css={[PostFull, NoImage]}>
47+
<PostFullHeader className="post-full-header">
48+
<PostFullTitle className="post-full-title">Packages</PostFullTitle>
49+
</PostFullHeader>
50+
51+
<PostFullContent className="post-full-content">
52+
<div className="post-content">
53+
<h5>A List of FuryStack Packages</h5>
54+
55+
56+
<p>
57+
The main goal of FuryStack is to bring enterprise-grade architecture to the NodeJS Ecosystem with a pack of separated but perfectly matched parts.
58+
You can build a modern scalable backend service in no-time and a responsive SPA frontend without bloating your app with 3rd party
59+
and low quality, often abandoned dependencies. Developer experience is the main focus while the framework also tries to encourage keeping the code
60+
clean and decoupled.
61+
</p>
62+
<p>
63+
FuryStack contains all the basic parts that you need to start with - like DI/IOC, authentication, data stores, entity authorization, logging, etc... -
64+
If you want to use only a subset of the layers (e.g. only the the Dependency Injection) you can also pick the one you like.
65+
</p>
66+
<p>
67+
In FuryStack, there are some concepts that are not very common nowdays - like sharing REST API definitions
68+
with type checking between the service and the frontend in a monorepo.
69+
</p>
70+
71+
</div>
72+
</PostFullContent>
73+
</article>
74+
</div>
75+
</main>
76+
<Footer />
77+
</Wrapper>
78+
</IndexLayout>
79+
}
80+
81+
export default PackagesPage

src/templates/post.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ const PageTemplate = ({ data, pageContext, location }: PageTemplateProps) => {
143143
<meta property="article:published_time" content={post.frontmatter.date} />
144144
{/* not sure if modified time possible */}
145145
{/* <meta property="article:modified_time" content="2018-08-20T15:12:00.000Z" /> */}
146-
{post.frontmatter.tags && (
147-
<meta property="article:tag" content={post.frontmatter.tags[0]} />
148-
)}
146+
{post.frontmatter?.tags.map(tag => <meta key={tag} property="article:tag" content={tag} />)}
149147

150148
{config.facebook && <meta property="article:publisher" content={config.facebook} />}
151149
{config.facebook && <meta property="article:author" content={config.facebook} />}

0 commit comments

Comments
 (0)