• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

koodi101/lesson3-nodejs-template: Lesson 3: The first backend application using ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

koodi101/lesson3-nodejs-template

开源软件地址:

https://github.com/koodi101/lesson3-nodejs-template

开源编程语言:

JavaScript 90.8%

开源软件介绍:

Koodi101 chat example

This is the repository for a simple chat application using koa, a Node.js web server framework, and sequelize, which maintains the SQLite database.

Prerequisites

You can run the example with Node.js or Docker.

Node.js is a programming language based on JavaScript which allows you to read files, create processes and run server software. Regular JavaScript is run within a web browser and has no access to the filesystem or processes.

Docker is a tool that allows a programmer to easily deploy their applications in a sandbox (called containers). Docker is used to run software that consists of multiple pieces (called services) which together work for example as a web server.

Docker cannot be installed in Windows 10 Home edition

This project uses Docker to run Node.js behind the scene

Running the example

First you need to clone the git repository using a command-line tool called git

git clone https://github.com/koodi101/lesson3-nodejs-template

Command-line commands usually look like this:

COMMAND [SUBCOMMAND] [ARGUMENTS]

The square brackets [] mean that the part is optional

After cloning the repository, you have to change your working directory so that future commands can find required files, like package.json and docker-compose.yml

cd lesson3-nodejs-template

To confirm you are in the correct directory, use the command

ls

You should now see something similar to

$ ls
backend  docker-compose.yml  README.md

cd means change directory and ls is short for list.

The dollar sign $ indicates that the following commands are written to the command-line terminal

Running with plain Node.js

npm install
npm run dev

Running using Docker & docker-compose

docker-compose build
docker-compose up

Exercises

The app

  • Use Postman, curl or similiar to
    • Post a new message to /api/chats
    • Get the messages from /api/chats
  • Add nickname and chat rooms to messages
  • Create a new endpoint /api/chats/<room> that returns messages for specific room

Deploy

  • Use SSH keys to login to the server
  • Install needed dependencies
  • Use Docker to deploy your application to the server



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap