2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Expressを使ってhello world

Last updated at Posted at 2018-11-10

https://expressjs.com/ja/
に、書かれているインストールとhello worldをするだけの簡単なお仕事。

環境

macOS Mojave ver 10.14

express install

$ npm init
$ ls .
package.json
$ npm install express --save
$ ls .
node_modules
package-lock.json
package.json

hello world

index.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 index.js

とすると、http://localhost:3000/ にアクセスしてページが表示できるようになります。

簡単ですね。

2
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?