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 1 year has passed since last update.

Express Generator でWebアプリ作成

Posted at

はじめに

この記事では、Express Generator を使ったWebアプリの作成方法について記載していきます。

前提

開発環境は以下の通りです。

  • Windows11
  • VSCode
  • JavaScript
  • Node.js 18.14.0

Express Generator のインストール

以下のコマンドで Express Generator をインストールします。

npx express-generator

プロジェクトファイルが作成されました。
image.png

パッケージインストール

以下のコマンドで、package.json を元に必要なパッケージをインストールします。

npm install

アプリの起動

以下のコマンドでアプリを起動します。

set DEBUG=express-generator-sample:*
npm start

起動することができました。

image.png
routes/index.js のコードが表示されます。

routes/index.js
var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

module.exports = router;

参照

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?