npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@actbase/node-server

v1.1.18

Published

Node Server Framework

Downloads

75

Readme

@actbase/node-server

Node.js를 위한 express기반의 웹 프레임워크.

NPM Version NPM Downloads

const app = require('@actbase/node-server');

app.run();

설치

@actbase/node-server는 npm registry를 통해 사용할 수 있는 Node.js 모듈 입니다.

설치하기 전에 Node.js를 다운로드하여 설치해주세요. Node.js 0.10 이상이 필요합니다.

만약 새로운 프로젝트를 만들 경우 npm init을 사용하여 프로젝트를 생성 합니다.

설치는 npm install을 사용하여 설치됩니다.

$ npm install @actbase/node-server

특징

  • Express 기반의 웹 프레임워크
  • Async await 지원
  • Oauth 지원
  • sequelize기반의 orm지원
  • Swagger 3 기본 지원

시작

Route

앤드포인트(URI)가 클라이언트 요청에 응답하는 방법을 나타내는 Route입니다.

import { createRoute } from '@actbase/node-server';
import UserService from '../services/UserSerivce';

const execute = ({ user }) => {
  return UserService.getMe(user);
};

export default createRoute(
  {
    method: 'GET',
    uri: '/me',
  },
  execute,
  {
    tags: 'User',
    description: 'Get Me',
  },
);

Model

Database Table 정보를 담고있는 Model 입니다.

import { createModel, TypeIs } from '@actbase/node-server';

const User = createModel(
  'users',
  {
    username: { type: TypeIs.STRING, comment: '아이디' },
    password: { type: TypeIs.STRING, comment: '비밀번호' },
  },
  {
    with: ['*'],
  },
);

export default User;

DTO

데이터 객체 선언(Data Transfer Object) 파일입니다.

import { createDto } from '@actbase/node-server';
import User from '../models/User';

export default createDto(
  'UserMeDto',
  {
    username: { type: TypeIs.STRING, comment: '아이디' },
  },
  {
    defineModel: User,
  },
);

Service

비즈니스 로직을 담고있는 Service입니다.

import { createService } from '@actbase/node-server';
import User from '../models/User';
import UserMeDto from '../dtos/UserMeDto';

export default createService({
  getMe: (repo, [user]) => {
    const userMe = repo.findOne(User, {
      exportTo: UserMeDto,
      where: {
        id: user.id,
      },
    });
    if (!userMe) throw { status: 404, message: 'Not found User' };
    return UserMeDto.map(userMe);
  },
});