Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sibelius/await-node-repl
Example of how to setup a repl with await syntax support
https://github.com/sibelius/await-node-repl
async-await node repl
Last synced: 2 months ago
JSON representation
Example of how to setup a repl with await syntax support
- Host: GitHub
- URL: https://github.com/sibelius/await-node-repl
- Owner: sibelius
- Created: 2017-01-09T19:28:17.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-09T19:38:32.000Z (almost 8 years ago)
- Last Synced: 2024-10-19T19:54:08.183Z (2 months ago)
- Topics: async-await, node, repl
- Language: JavaScript
- Size: 22.5 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Await Node Repl
## Blog post
https://medium.com/@sibelius/node-repl-with-await-syntax-6e351e347292#.cnqogx385## Setup
First, install deps
```
yarn
```Then run the repl and start hacking
```
yarn run repl
```## Examples
### Do a fetch in a website
```jsx
> const response = await fetch('http://example.com');
> const data = await response.json();
```### Work with database models
```jsx
> await connectDatabase();
> const user = await User.find(); // get all users
```### Play with a package
```jsx
> import faker from 'faker'
> faker.internet.password()
```### Add some data and functions to repl context
add something like this to repl.js
```jsx
repl.context.myfunc = myfunc;
```test it
```jsx
> myFunc()
```\o/