xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Async Programming All in One

Async Programming All in One

Async & Await

Frontend

(async () => {
	const url = "https://cdn.xgqfrms.xyz/json/awesome-developer.json"
	const result = await fetch(url).json()

	if(result.name == `xgqfrms`) {
		alert('You are awesome!')
	} else {
		alert('You are awesome too!')
	}
})();

Backend

#!/usr/bin/env python
import asyncio as io
import websockets as ws

async def hello(websocket, path):
		name = await websocket.recv()
		greeting = f"Hello {name}!"
		await websocket.send(greeting)

server = ws.serve(hello, 'localhost', 1337)
io.get_event_loop().run_until_complete(server)
io.get_event_loop().run_forever()


Mobile APP

import 'package:flutter/widgets.dart';
void main() {
 runApp(
  const Center(
   child: Text(
    'Hello, world!',
    textDirection: TextDirection.ltr
   )
  )
 );
}

DevOps

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:8.11.2
    working_directory: ~/codedamn

    steps:
      - checkout
      - run: 
          name: Install Dependencies
          command: npm install
      - run: npm run test

refs

https://codedamn.com/

vim



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2020-07-20 13:39  xgqfrms  阅读(126)  评论(1编辑  收藏  举报