Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This repository contains a sample showcasing Web APIs with Node.js compared to ASP.NET Core 1.0

NotificationsYou must be signed in to change notification settings

thinktecture/nodejs-aspnetcore-webapi

Repository files navigation

This repository contains a Web API sample built with Node.js and ASP.NET Core 1.0. A Angular 2 client is used to communicate with the APIs. A lot of things in this repo are covered by ablog series.

Projects

Both Node.js and ASP.NET Core 1.0 APIs are split into two projects:

  • STS: Contains a Secure Token Service, which can generate and validate access tokens
  • Web API: Contains a Web API for manipulating customers.
    • The following methods are supported. All methods need a valid access token, otherwise it will return a401 Unauthorized.
      • HTTP GET api/customer/list: Returns a list of all customers
      • HTTP POST api/customer: Creates a new customer
      • HTTP DELETE api/customer/{id}: Removes a customer
    • Swagger support viahttp://localhost:5000/swagger
    • Both project can either use an InMemory storage or a PostgreSQL backend. Per default, they use PostgreSQL.
      • Node.js:
        • Switch theservice.configure(false) totruehere
        • Additionally Node.js supports MongoDB which can be switchedhere
        • Default PostgreSQL settings:
          • Host:localhost
          • Database name:CustomerSampleNodejs
          • Username:CustomerSample
          • Password:CustomerSample
          • Can be configured inserver/index.js
      • ASP.NET Core 1.0:
        • Switch the comments withinConfigureDIhere
        • Default PostgreSQL settings:
          • Host:localhost
          • Database name:CustomerSampleVNext
          • Username:CustomerSample
          • Password:CUstomerSample
          • Can be configured inStartup.cs

You can either start both projects as Node.js or as ASP.NET Core 1.0. They won't work together, so you can not use Node.js STS and ASP.NET Core 1.0 Web API.

Setup

PostgreSQL

For a general admin UI to create users and databases, you can usepgAdmin, which works on all platforms.

OS X

The easiest way to use PostgreSQL on Mac OS X is by installingPostgres.app. Then use the pgAdmin to create the user and databases as shown above.

Windows

To install PostgreSQL on Windows you can use a graphical installer which can be downloadedhere. It comes with pgAdmin, so you don't need to install it separately. After installation use pgAdmin to create the user and databases as shown above.

MongoDB

To install MongoDB, head over to theofficial website, download and install it regarding their documentation.

MongoDB is currently not supported for ASP.NET Core 1.0 Web API project, yet.

Node.js

  • InstallNode.js > v5 .
  • Executenpm install within the root of this repository to install all necessary dependencies. You will encounter somenpm err ornpm warn. That's okay, since this repository uses a lot beta versions. It will not break the application.

ASP.NET Core 1.0

  • ASP.NET 5.
  • After installing ASP.NET 5 you need to executednu restore insrc/aspNetCore/STS andsrc/aspNetCore/WebAPI.

Starting

Node.js

  • STS: To start STS executenode index.js insrc/nodejs/STS. It will then be accessible viahttp://localhost:5001.
  • Web API: To start Web API executenode index.js insrc/nodejs/WebAPI. It will then be accessible viahttp://localhost:5000.

ASP.NET Core 1.0

  • STS: To start STS executednx web insrc/aspNetCore/STS. It will then be accessible viahttp://localhost:5001.
  • Web API: To start Web API executednx web insrc/aspNetCore/WebAPI. It will then be accessible viahttp://localhost:5000.

Angular 2 Client

To start the Angular 2 Client, runnpm run watch within the root of the repository. You can access the client viahttp://localhost:8000. The credentials are

  • Username:bob
  • Password:bob

Since both backends lack a support for user management, those credentials are the only one which are working. :-)

Presentation

If you want to start the presentation yourself, you need to spin up a static http server (likenode-static) in thepresentation directory.

Third-Party Libraries

This section contains notable third-party libraries.

General

Node.js

ASP.NET Core 1.0

Angular 2 Client

Contributors

Additional resources

About

This repository contains a sample showcasing Web APIs with Node.js compared to ASP.NET Core 1.0

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp