0
1

More than 3 years have passed since last update.

【NodeJS】Express(Webアプリ)入門

Posted at

当記事の目的

Express(Webアプリ)のサンプルを作成。

プロジェクト用フォルダを作成

mkdir myapp
cd myapp

プロジェクト用packege.json作成

npm init

Expressパッケージをインストール

npm install express --save

インストール済みのパッケージを確認

npm list --depth=0
`-- express@4.17.1

各種ファイル作成

myapp ディレクトリーで、app.js というファイルを作成

app.js
const express = require('express')
const app = express()

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(3000, () => console.log('Example app listening on port 3000!'))

起動

> node app.js
Example app listening on port 3000!

画面

http://localhost:3000/
サンプルが面.png

参考

Express
https://expressjs.com/

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1