nodejs MVC框架:Adonisjs框架入门-002环境安装和创建项目

安装nodejs环境

官网下载地址:https://nodejs.org/en/download/

 

新建Adonisjs项目

打开命令行窗口(这里以windows为例介绍),在命令行窗口中输入以下命令:


D:\workspace\nodejs>npm init adonis-ts-app@latest pj_hell
npx: installed 193 in 10.965s
    _       _             _         _
   / \   __| | ___  _ __ (_)___    | |___
  / _ \ / _` |/ _ \| '_ \| / __|_  | / __|
 / ___ \ (_| | (_) | | | | \__ \ |_| \__ \
/_/   \_\__,_|\___/|_| |_|_|___/\___/|___/


CUSTOMIZE PROJECT
> Select the project structure ...  Press <ENTER> to select
  api   (Tailored for creating a REST API server)
 >web   (Traditional web application with server rendered templates)
  slim  (A smallest possible AdonisJS application)

 

 

系统提示三个选项,api,web,slim,这里我们选择 web, 然后继续安装,安装完成界面如下

> Select the project structure · web
> Enter the project name · pj_hell
> Setup eslint? (y/N) · false
> Configure webpack encore for compiling frontend assets? (y/N) · false

RUNNING TASKS
> Scaffold project 77 ms
> Install dependencies 29 s
> Configure installed packages 850 ms

[ success ]  Project created successfully

╭─────────────────────────────────────────────────╮
│    Run following commands to get started        │
│─────────────────────────────────────────────────│
│                                                 │
│    > cd pj_hell                                 │
│    > node ace serve --watch                     │
│                                                 │
╰─────────────────────────────────────────────────╯


D:\workspace\nodejs>

 

接下来我们用vscode打开项目查看目录结构

 

接下来我们运行项目看一下,命令行或vscode的终端中输入命令:node ace serve --watch  

出现以下界面,说明项目运行起来了;

PS D:\workspace\nodejs\pj_hell> node ace serve --watch
[ info ]  building project...
[ info ]  starting http server...
[1623337134401] INFO (pj_hell/14596 on DESKTOP-NS66ME0): started server on 0.0.0.0:3333
[ info ]  watching file system for changes
╭─────────────────────────────────────────────────╮
│                                                 │
│    Server address: http://127.0.0.1:3333        │
│    Watching filesystem for changes: YES         │
│                                                 │
╰─────────────────────────────────────────────────╯

在浏览器中输入 http://127.0.0.1:3333查看运行结果

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

海阔天空_cn

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值