Skip to content

Fetch My Code | Wiki

Tejas Nayak edited this page Jun 29, 2023 · 1 revision

Creating a project

On login, you will be redirected to the dashboard.

  1. Click on new project
  2. Enter the data
  3. Click on create
Package Name is the name of the package you're going to create.
Ex: com.packagename.apk.
App Name is the name of the app you're creating.
Ex: Example App
Token is the fine-grained token with read-only permissions to your repository which contains the code for your project (private or public).

Fill in the other details with respect to your project.

Installation

Open your code editor. Run this in the terminal after npm init.

Make sure the values of packageName, appName, author keys in your package.json file are exactly the same as the ones you entered while creating a project in https://serve-my-code.onrender.com/

npm i fetch-my-code

Create index.js file and put this snippet of code in the file.

require("fetch-my-code");

Your receiver-end is now ready. Now, you just have to edit your repository and your app is automatically updated.

Important Notes :-

  1. An express js app is already running on the port (process.env.PORT || 9000). You can just use the same app for your project using the app variable.
  2. Local media can't be loaded yet. You may use the external URLs though.
  3. The static directory is declared by default. So any of your files in the static directory will be loaded whenever requested.
  4. Important Syntaxes:-
For static files:
<script src="/static/hello.js"></script>

For require statements:
1) For node_modules:
Ex: require('express');

2) For files:
Ex: require("static/hello.js");

Clone this wiki locally