Skip to content

Commit

Permalink
feat(local-server): add local server option
Browse files Browse the repository at this point in the history
- Add local server option because opening the `index.html` file with the browser causes CORS error when trying to get the local file `data.json`
- Change source of "data.json" to root directory (`dist`)
- Remove unused files
  • Loading branch information
omurilo committed May 3, 2020
1 parent 219fbb5 commit c28807c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 106 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
end_of_line = lf
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Este repositório contém a tela de countdown usada no canal do [Código Falado]
3. Customize o CSS em `src/App.vue` para deixar com a fonte do seu canal.
4. Rode `npm install` para instalar as dependências.
5. Rode `npm run build` para criar a pasta `dist` contendo o Countdown funcionando.
6. Acesse a pasta `dist` através do seu navegador.
7. Você pode definir os minutos e o título da página através de query string na URL. Ex.: `https://codigofalado.test/dist?minutes=15&title=Meu+T%C3%ADtulo+De+Exemplo`
8. Altere o arquivo `public/data.json` com o título / subtítulo / parágrafo da sua transmissão **sempre que for começar uma nova Live**.
9. Adicione o caminho para o `/dist/index.html?minutes=15&title=Meu+T%C3%ADtulo+De+Exemplo` no OBS via Browser Source
6. Adicione a url `http://localhost:5000` no OBS via Browser Source
7. Você pode definir os minutos e o título da página através de query string na URL. Ex.: `http://localhost:5000/?minutes=15&title=Meu+T%C3%ADtulo+De+Exemplo`
8. Altere o arquivo `dist/data.json` com o título / subtítulo / parágrafo da sua transmissão **sempre que for começar uma nova Live**.
9. Rode `npm run stream` para iniciar um servidor local com o Countdown na porta 5000 **sempre que for começar uma nova Live**.

# Customizando o Projeto

Expand All @@ -36,8 +36,20 @@ npm run serve
npm run build
```

### Inicia um servidor em localhost

```
npm run stream
```

### Lint

```
npm run lint
```

# Servidor externo (opcional)
> Rode o comando abaixo e envie os arquivos da pasta /dist gerada para o seu servidor
```bash
npm run build
```
1 change: 0 additions & 1 deletion agora.txt

This file was deleted.

1 change: 0 additions & 1 deletion depois.txt

This file was deleted.

38 changes: 0 additions & 38 deletions index.html

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"lint": "vue-cli-service lint",
"stream": "serve ./dist"
},
"dependencies": {
"core-js": "^3.6.4",
Expand All @@ -20,6 +21,7 @@
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"serve": "^11.3.0",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
Expand Down
5 changes: 2 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ export default {
stream_paragraph: "",
};
},
async created() {
const data = await fetch("../data.json");
async mounted() {
const data = await fetch("./data.json");
const config = await data.json();
console.log(config);
this.stream_title = config["stream-title"];
this.stream_subtitle = config["stream-subtitle"];
this.stream_paragraph = config["stream-paragraph"];
Expand Down
58 changes: 0 additions & 58 deletions src/components/HelloWorld.vue

This file was deleted.

0 comments on commit c28807c

Please sign in to comment.